Memory leak in WPG parser
Posted: 2016-09-20T06:49:16-07:00
When I try convert malformed WPG image, ImageMagick leaks memory in WPG parser.
IM Version (compiled from source):
Source file
To reproduce:
LeakSanitizer Output:
Found with American Fuzzy Lop ( http://lcamtuf.coredump.cx/afl/ )
IM Version (compiled from source):
Code: Select all
Version: ImageMagick 7.0.3-0 Q16 x86_64 2016-09-14 http://www.imagemagick.org
To reproduce:
Code: Select all
convert crash.wpg a.jpg
Code: Select all
==19859==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 7585 byte(s) in 1 object(s) allocated from:
#0 0x7f7c83446602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7f7c82e83a1c in UnpackWPG2Raster coders/wpg.c:578
#2 0x7f7c82e83a1c in ReadWPGImage coders/wpg.c:1356
SUMMARY: AddressSanitizer: 7585 byte(s) leaked in 1 allocation(s).