malloc failures in java/util/zip/Deflater

2009-07-08 Thread Mario Torre
Hi all, I've found a problem in the Deflater code in OpenJDK, where a length of zero bytes is passed to malloc. According to the specs, malloc may return either a valid pointer that can be passed to free, or NULL, while generally NULL is considered to be a failure. Linux and Solaris, albeit

Re: malloc failures in java/util/zip/Deflater

2009-07-08 Thread Roman Kennke
Hi Mario, > According to the specs, malloc may return either a valid pointer that > can be passed to free, or NULL, while generally NULL is considered to be > a failure. Linux and Solaris, albeit non specifying it, return always a > valid pointer, as far as I know I think NULL is returned in a

Re: malloc failures in java/util/zip/Deflater

2009-07-08 Thread Mario Torre
Il 08/07/2009 20:52, Roman Kennke ha scritto: Hi Mario, According to the specs, malloc may return either a valid pointer that can be passed to free, or NULL, while generally NULL is considered to be a failure. Linux and Solaris, albeit non specifying it, return always a valid pointer, as far as

Re: malloc failures in java/util/zip/Deflater

2009-07-08 Thread Roman Kennke
Hi Mario, > >> According to the specs, malloc may return either a valid pointer that > >> can be passed to free, or NULL, while generally NULL is considered to be > >> a failure. Linux and Solaris, albeit non specifying it, return always a > >> valid pointer, as far as I know > > > > I think NULL

Re: malloc failures in java/util/zip/Deflater

2009-07-08 Thread David Holmes - Sun Microsystems
Hi Mario, I'm not familiar with this particular code but doesn't a value of this_len==0 imply that there's nothing to do and a whole chunk of code here can be skipped? Is finding this_len==0 even valid here? Your patch fixes your problem, but it seems to me the code either shouldn't get this

Re: malloc failures in java/util/zip/Deflater

2009-07-09 Thread Kelly O'Hair
I tend to agree. Shouldn't a zero length entry be treated special, or disallowed? -kto David Holmes - Sun Microsystems wrote: Hi Mario, I'm not familiar with this particular code but doesn't a value of this_len==0 imply that there's nothing to do and a whole chunk of code here can be skippe

Re: malloc failures in java/util/zip/Deflater

2009-07-09 Thread Xueming Shen
Zero length entry should be allowed. This is a regression, the result of the un-successful fix for 6728376:-( The webrev for 6728376 is http://cr.openjdk.java.net/~sherman/6728376/webrev We have the same in Inflater as well. I will file a bug for it. Thanks Mario for catching this. Sherman K

Re: malloc failures in java/util/zip/Deflater

2009-07-09 Thread Mario Torre
Il 09/07/2009 18:57, Kelly O'Hair ha scritto: I tend to agree. Shouldn't a zero length entry be treated special, or disallowed? -kto Hi Kelly, Maybe I misunderstood the code, because I didn't went into it in so great details, but I think that the zero length is already considered special b

Re: malloc failures in java/util/zip/Deflater

2009-07-09 Thread Mario Torre
Il 09/07/2009 19:41, Xueming Shen ha scritto: Zero length entry should be allowed. This is a regression, the result of the un-successful fix for 6728376:-( The webrev for 6728376 is http://cr.openjdk.java.net/~sherman/6728376/webrev We have the same in Inflater as well. I will file a bug for i