malloc failures in java/util/zip/Deflater (original) (raw)

Xueming Shen Xueming.Shen at Sun.COM
Thu Jul 9 17:41:53 UTC 2009


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

Kelly O'Hair wrote:

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 thislen==0 imply that there's nothing to do and a whole chunk of code here can be skipped? Is finding thislen==0 even valid here? Your patch fixes your problem, but it seems to me the code either shouldn't get thislen==0 or else should be handling it differently. Cheers, David Holmes Mario Torre said the following on 07/09/09 03:59: 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 non specifying it, return always a valid pointer, as far as I know, but I have a weird OS here that does indeed return NULL. I've fixed this issue locally, and thought I could share the patch with you: http://cr.openjdk.java.net/~neugens/deflater/webrev.00/ Cheers, Mario



More information about the core-libs-dev mailing list