Reverse order of tests in png_zlib_compress_validate

Undefined behaviour sanitizer currently fires for this test
with an error about member access within null pointer to
struct; put the check that relies on pz->list being non-NULL
second.
This commit is contained in:
David Drysdale 2015-12-21 11:29:03 +00:00
parent 1bfeb46881
commit 28fa0d23c1

View File

@ -482,10 +482,10 @@ png_zlib_compress_validate(png_zlib_compressp pz, int in_use)
if (pz->overflow == 0U && pz->len == 0U && pz->start == 0U) /* empty */
{
affirm((pz->end == &pz->list->next && pz->zs.next_out == pz->list->output
&& pz->zs.avail_out == o_size) ||
(pz->end == &pz->list && pz->zs.next_out == NULL
&& pz->zs.avail_out == 0U));
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));
}
else /* not empty */