Menu

#85 heap-buffer-overflow in read_textobject at read.c:1500

fig2dev
closed
nobody
None
2020-12-21
2020-02-24
Suhwan Song
No

Hi,
I found a heap-buffer-overflow in read_textobject at read.c:1500

fig2dev Version 3.2.7b
commit ca48ccc90bd3e7801a63cf9a541f292b28ed1260

Please run following command to reproduce it,

fig2dev -L box $PoC

ASAN LOG

==2655==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6160000005aa at pc 0x0000004da1e2 bp 0x7ffe75a03090 sp 0x7ffe75a02840
READ of size 520 at 0x6160000005aa thread T0
    #0 0x4da1e1 in __asan_memcpy (/home/tmp/fig2dev+0x4da1e1)
    #1 0x596465 in read_textobject /home/tmp/mcj-fig2dev/fig2dev/read.c:1500:3
    #2 0x59c47f in read_compoundobject /home/tmp/mcj-fig2dev/fig2dev/read.c:774:16
    #3 0x56926a in read_objects /home/tmp/mcj-fig2dev/fig2dev/read.c:474:16
    #4 0x56926a in readfp_fig /home/tmp/mcj-fig2dev/fig2dev/read.c:151
    #5 0x565743 in read_fig /home/tmp/mcj-fig2dev/fig2dev/read.c:123:10
    #6 0x548913 in main /home/tmp/mcj-fig2dev/fig2dev/fig2dev.c:423:12
    #7 0x7f1639674b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #8 0x41b469 in _start (/home/tmp/fig2dev+0x41b469)

0x6160000005aa is located 0 bytes to the right of 554-byte region [0x616000000380,0x6160000005aa)
allocated by thread T0 here:
    #0 0x4db7a0 in realloc (/home/tmp/fig2dev+0x4db7a0)
    #1 0x7f16396d2be7 in getdelim /build/glibc-OTsEL5/glibc-2.27/libio/iogetdelim.c:102
    #2 0x7f1635efff2f  (<unknown module>)

SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/tmp/fig2dev+0x4da1e1) in __asan_memcpy
Shadow bytes around the buggy address:
  0x0c2c7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff80a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c2c7fff80b0: 00 00 00 00 00[02]fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff8100: 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
==2655==ABORTING
1 Attachments

Discussion

  • tkl

    tkl - 2020-02-25
    • status: open --> pending
     
  • tkl

    tkl - 2020-02-25

    Fixed with commit [963951].

     

    Related

    Commit: [963951]

  • tkl

    tkl - 2020-12-21
    • status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB