sass / sassc

libsass command line driver
Other
784 stars 131 forks source link

AddressSanitizer: heap-buffer-overflow src/sass_context.cpp:81 in handle_error #238

Open fgeek opened 5 years ago

fgeek commented 5 years ago

Tested commit: 43c4000734aabede1d938f52f3a5cd04708b54ac Credit: Henri Salo sassc-heap-buffer-overflow-handle-error-001.txt

=================================================================
==7576==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60600000e9f4 at pc 0x55c57acf69dd bp 0x7ffcd5d72860 sp 0x7ffcd5d72858
READ of size 1 at 0x60600000e9f4 thread T0
    #0 0x55c57acf69dc in handle_error src/sass_context.cpp:81
    #1 0x55c57acf965c in handle_errors src/sass_context.cpp:207
    #2 0x55c57ad3c95b in sass_parse_block src/sass_context.cpp:253
    #3 0x55c57ad3c95b in sass_compiler_parse src/sass_context.cpp:483
    #4 0x55c57ad3da20 in sass_compile_context src/sass_context.cpp:371
    #5 0x55c57ad3da20 in sass_compile_file_context src/sass_context.cpp:470
    #6 0x55c57ad216b0 in compile_file /home/hsalo/src/sassc/sassc/sassc.c:158
    #7 0x55c57acfc82a in main /home/hsalo/src/sassc/sassc/sassc.c:370
    #8 0x7f642b8292e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #9 0x55c57ad20d49 in _start (/home/hsalo/src/sassc/sassc/bin/sassc+0x84d49)

0x60600000e9f4 is located 0 bytes to the right of 52-byte region [0x60600000e9c0,0x60600000e9f4)
allocated by thread T0 here:
    #0 0x7f642c70ad28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
    #1 0x55c57af35df3 in Sass::File::read_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) src/file.cpp:463
    #2 0x55c57ad7b22d in Sass::File_Context::parse() src/context.cpp:574
    #3 0x55c57ad3be11 in sass_parse_block src/sass_context.cpp:234
    #4 0x55c57ad3be11 in sass_compiler_parse src/sass_context.cpp:483
    #5 0x55c57ad3da20 in sass_compile_context src/sass_context.cpp:371
    #6 0x55c57ad3da20 in sass_compile_file_context src/sass_context.cpp:470
    #7 0x55c57ad216b0 in compile_file /home/hsalo/src/sassc/sassc/sassc.c:158

SUMMARY: AddressSanitizer: heap-buffer-overflow src/sass_context.cpp:81 in handle_error
Shadow bytes around the buggy address:
  0x0c0c7fff9ce0: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
  0x0c0c7fff9cf0: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
  0x0c0c7fff9d00: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c0c7fff9d10: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
  0x0c0c7fff9d20: fd fd fd fd fd fd fd fd fa fa fa fa 00 00 00 00
=>0x0c0c7fff9d30: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00[04]fa
  0x0c0c7fff9d40: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
  0x0c0c7fff9d50: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
  0x0c0c7fff9d60: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c0c7fff9d70: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
  0x0c0c7fff9d80: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
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
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  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
==7576==ABORTING