Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
memory leak in png_malloc_warn and png_create_info_struct #307
Hi,libpng team. there are memory leaks in the function
I compiler gif2png to the 32-bit LSB version with ASAN. The software runs in the x86-64 Ubuntu 16.04 services.
the bug is trigered by
the asan debug info is as follows:
Direct leak of 64056 byte(s) in 51 object(s) allocated from:
Direct leak of 17544 byte(s) in 51 object(s) allocated from:
Direct leak of 6656 byte(s) in 26 object(s) allocated from:
Direct leak of 2048 byte(s) in 8 object(s) allocated from:
SUMMARY: AddressSanitizer: 90304 byte(s) leaked in 136 allocation(s).
@zer0yu Hi, could you please offer more information about how to reproduce this bug.
I have cloned gif2png and checkout to tag 2.5.9, the latest version is 3.0.0 and is ported to Golang.
After compiling gif2png and extracting gif file(renamed to poc.gif) from your attachment, I executed
and some files:
poc.p01...poc.p50 are empty files.
But no message about memory leakage were generated.
@zer0yu Hi, I had some tests on gif2png. But I need your help.
I used valgrind to check the memory leakage by executing
We can see the key function
So I reviewed the gif2png source code, whose git-tag was 2.5.9 and commit id was
Here is my patch to fixed it.
And here is the new output message
So my conclusion is that: the memory leakage is caused by gif2png but NOT libpng.
Sorry, it’s my mistake.