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

Image::Indexed::setTransp@image.cpp:563-35___heap-buffer-overflow #63

Closed pts closed 5 years ago

pts commented 5 years ago
./sam2p.asan -- pwd-sam2p-sam2p-01/vuln/Image::Indexed::setTransp@image.cpp:563-35___heap-buffer-overflow t.ps                                                                                                                                                                              pts@pts.zrh/pts/6
This is sam2p 0.49.4.
Available Loaders: PS PDF JAI PNG JPEG TIFF PNM BMP GIF LBM XPM PCX TGA.
Available Appliers: XWD Meta Empty BMP PNG TIFF6 TIFF6-JAI JPEG-JAI JPEG PNM GIF89a+LZW XPM PSL1C PSL23+PDF PSL2+PDF-JAI P-TrOpBb.
=================================================================
==156004==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60c0000043c0 at pc 0x555d63e88faa bp 0x7ffe2cd51ca0 sp 0x7ffe2cd51c98
READ of size 1 at 0x60c0000043c0 thread T0
    #0 0x555d63e88fa9 in Image::Indexed::setTransp(unsigned char) /usr/local/google/home/pts/prg/sam2p/image.cpp:563
    #1 0x555d63e30636 in in_gif_reader /usr/local/google/home/pts/prg/sam2p/in_gif.cpp:72
    #2 0x555d63e967d9 in Image::load(Image::Loader::UFD*, SimBuffer::Flat const&, char const*) /usr/local/google/home/pts/prg/sam2p/image.cpp:1435
    #3 0x555d63e070b4 in run_sam2p_engine(Files::FILEW&, Files::FILEW&, char const* const*, unsigned char) /usr/local/google/home/pts/prg/sam2p/sam2p_main.cpp:1055
    #4 0x555d63e08700 in main /usr/local/google/home/pts/prg/sam2p/sam2p_main.cpp:1148
    #5 0x7f32dc5b52b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
    #6 0x555d63dfd1b9 in _start (/usr/local/google/home/pts/prg/sam2p/sam2p.asan+0x281b9)

Discovered in https://github.com/pts/sam2p/issues/62.

pts commented 5 years ago

Fixed in 313e639ffc56743fe2250749c445147ab86bb97a.

@YourButterfly, thank you for reporting this!