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 Alan.Bateman at
Fri Nov 19 09:31:21 UTC 2010

Xueming Shen wrote:
> Alan,
> It might not be a real "regression" if only consider the supported 
> platforms
> (and yes, the malloc manpageI can found does clearly indicate NULL is 
> for error).
> However I prefer to add some checks to make sure it behaves the same
> (compared to before the #6728376 change went it), even on the "weird OS"
> that Mario has. Anyway, a 0-length really malloc should not trigger a 
> The webrev for #6728376 is at
> Thanks,
> -Sherman
I think this one has come up before [1].  Looking at it now, I wonder if 
it would be simpe for inflate to just return 0 if the input buffer or 
the max number of uncompressed bytes is 0. That is, just don't attempt 
the mallocs for these cases.



More information about the core-libs-dev mailing list