lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.08k stars 425 forks source link

Memory leaks in function benchmark. #176

Open yangfar opened 1 year ago

yangfar commented 1 year ago

Detail

================================================================= ==1082665==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16384 byte(s) in 4 object(s) allocated from:

0 0x495dcd in malloc (/home/hjsz/fuzz_software/lodepng-master/benchmark+0x495dcd)

#1 0x4fee62 in lodepng_malloc(unsigned long) /home/hjsz/fuzz_software/lodepng-master/lodepng.cpp:78:10
#2 0x4fee62 in lodepng_decode(unsigned char**, unsigned int*, unsigned int*, LodePNGState*, unsigned char const*, unsigned long) /home/hjsz/fuzz_software/lodepng-master/lodepng.cpp:5055:28
#3 0x52ecfc in testDecode(std::vector<unsigned char, std::allocator<unsigned char> > const&) /home/hjsz/fuzz_software/lodepng-master/lodepng_benchmark.cpp:197:26
#4 0x5318a5 in testFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/hjsz/fuzz_software/lodepng-master/lodepng_benchmark.cpp:261:5
#5 0x533b28 in main /home/hjsz/fuzz_software/lodepng-master/lodepng_benchmark.cpp:312:5
#6 0x7f6fd43cf082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16

SUMMARY: AddressSanitizer: 16384 byte(s) leaked in 4 allocation(s). Thanks for your time.

I saw the issues #165 , It should be the same problem. If the crash occues when normal user use the function rather than fuzzing the function?