Add NULL pz->list test to png_zlib_compress_validate

This seems safer; in fact a NULL dereference never happens because the test ends
up just doing arithmetic on NULL but it seems possible that the undefined
arithmetic can still happen if there is a bug elsewhere.

Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
John Bowler 2015-12-28 16:15:36 -08:00
parent 07c60a383a
commit 63ea57a796

View File

@ -484,8 +484,9 @@ png_zlib_compress_validate(png_zlib_compressp pz, int in_use)
{
affirm((pz->end == &pz->list && pz->zs.next_out == NULL
&& pz->zs.avail_out == 0U) ||
(pz->end == &pz->list->next && pz->zs.next_out == pz->list->output
&& pz->zs.avail_out == o_size));
(pz->list != NULL && pz->end == &pz->list->next &&
pz->zs.next_out == pz->list->output &&
pz->zs.avail_out == o_size));
}
else /* not empty */