Code review request 6858865: Fix for 6728376 causes regression if the size of "data" is 0 and malloc returns Null for 0-length
Alan.Bateman at oracle.com
Mon Nov 22 21:59:56 UTC 2010
Xueming Shen wrote:
> We can not simply return 0 if the "out" buffer length is NOT 0 even
> when "in" buffer length is 0. The de/inflater might
> have something to push/flush out even there is no more input. Consider
> the buffer in last invocation of de/inflating is
> not big enough, de/infalte() gets invoked the second time without any
> new data (and the data for the last invocation
> has been consumed by the zlib de/inflate). The patch-1 (the second
> one) is simply wrong.
> It is probably OK to return 0 if the output buffer is 0, I said
> "probably" is because I would need to read all those
> zlib code again to make sure there is no any internal status change
> (for example in case like the "in" buffer is NOT
> zero but the "out" buffer is 0, consider the de/inflater might try to
> consume more data even the output buffer is
> zero) or even if there is an internal status change it would not have
> any negative impact. This is why I'm saying
> it is probably not worth the effect.
The inflate/deflater state is a good point, in which case you are right
to be cautious as it's easy to get burned in the zip code. If your
replace the "Some weird system" comment with something to say that OOME
is only thrown then the length is not zero then the changes in webrev.00
are okay with me.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the core-libs-dev