malloc failures in java/util/zip/Deflater

Mario Torre neugens at limasoftware.net
Thu Jul 9 20:09:08 UTC 2009


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 because it signals the end of the stream, and the variable 
"finished" is hence set in the code.

I'll spend some more time on that, and tell you. In the meantime, to 
test it, what I did was something like:

if (len == 0) {
   in_buf = NULL;

} else {
   in_buf = malloc(len); // len == 0
}

if (in_buf == 0 && len > 0) {
     /* throw the exception */
}

and it worked without crashing :)

Cheers,
Mario



More information about the core-libs-dev mailing list