pts / sam2p

raster (bitmap) image converter with smart PDF and PostScript (EPS) output
http://pts.50.hu/sam2p/
GNU General Public License v2.0
42 stars 15 forks source link

Memory Leaks in PSEncoder::newASCIIHexEncode #42

Closed YourButterfly closed 6 years ago

YourButterfly commented 6 years ago

Description of problem:

memory leaks in PSEncoder::newASCIIHexEncode

Version-Release number of selected component (if applicable):

sam2p 0.49.4

The output information is as follows(with asan):

$ ./sam2p ~/Desktop/crashes-2018-06-20-14-32/sam2p000_id_000205\,sig_06\,src_001608\,op_havoc\,rep_4 thy.pdf

This is sam2p 0.49.4.
Available Loaders: PS PDF JAI PNG JPEG TIFF PNM BMP LBM XPM PCX TGA.
Available Appliers: XWD Meta Empty BMP PNG TIFF6 TIFF6-JAI JPEG-JAI JPEG PNM XPM PSL1C PSL23+PDF PSL2+PDF-JAI P-TrOpBb.
sam2p: Notice: job: read InputFile: /home/pwd/Desktop/crashes-2018-06-20-14-32/sam2p000_id_000205\,sig_06\,src_001608\,op_havoc\,rep_4
sam2p: Notice: writeTTT: using template: p02bb
sam2p: Notice: applyProfile: applied OutputRule #25 using applier PSL23+PDF
sam2p: Notice: job: written OutputFile: thy.pdf
Success.

=================================================================
==11047==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7ff741278458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
    #1 0x55886443ed54 in PSEncoder::newASCIIHexEncode(GenBuffer::Writable&, unsigned int) /home/pwd/fuzz/fuzz-sam2p/sam2p/encoder.cpp:1122

SUMMARY: AddressSanitizer: 24 byte(s) leaked in 1 allocation(s).

Other I don`t know how to debug this type of vuln, now. I will update. poc

pts commented 6 years ago

Thank you for reporting this! Fixed in 4fa3a2e9461d2922c1086194b3733a878686354b.