Skip to content

heap-buffer-overflow in function put_pixel_rows in wrbmp.c:145 #305

Closed
@cool-tomato

Description

@cool-tomato
fish@ubuntu:~/Desktop/2018-10-10/image/libjpeg-turbo-2.0.1$ ./afl/afl/bin/djpeg -colors 256 -bmp heap-buffer-overflow-2
Corrupt JPEG data: 117 extraneous bytes before marker 0xdb
=================================================================
==79144==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6100000000f7 at pc 0x558ce02a8b5d bp 0x7fffde75e590 sp 0x7fffde75e580
READ of size 1 at 0x6100000000f7 thread T0
    #0 0x558ce02a8b5c in put_pixel_rows /home/fish/Desktop/2018-10-10/image/libjpeg-turbo-2.0.1/wrbmp.c:145
    #1 0x558ce028f197 in main /home/fish/Desktop/2018-10-10/image/libjpeg-turbo-2.0.1/djpeg.c:762
    #2 0x7f0a3d9fcb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #3 0x558ce0290659 in _start (/home/fish/Desktop/2018-10-10/image/libjpeg-turbo-2.0.1/afl/afl/bin/djpeg+0x8659)

0x6100000000f7 is located 0 bytes to the right of 183-byte region [0x610000000040,0x6100000000f7)
allocated by thread T0 here:
    #0 0x7f0a3e141b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7f0a3de0ef68 in alloc_large /home/fish/Desktop/2018-10-10/image/libjpeg-turbo-2.0.1/jmemmgr.c:391
    #2 0x7f0a3de0ef68 in alloc_sarray /home/fish/Desktop/2018-10-10/image/libjpeg-turbo-2.0.1/jmemmgr.c:475

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fish/Desktop/2018-10-10/image/libjpeg-turbo-2.0.1/wrbmp.c:145 in put_pixel_rows
Shadow bytes around the buggy address:
  0x0c207fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c207fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c207fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c207fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c207fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
=>0x0c207fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[07]fa
  0x0c207fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c207fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c207fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c207fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c207fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==79144==ABORTING

heap-buffer-overflow-2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions