Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASan global-buffer-overflow src/stb_image.h:1913 in stbi__extend_receive #70

Closed
fgeek opened this issue Jul 19, 2018 · 2 comments
Closed
Assignees
Labels

Comments

@fgeek
Copy link

fgeek commented Jul 19, 2018

libsixel-global-buffer-overflow-stb_image.h-1913-stbi__extend_receive.png.zip (SHA1: 6fa73c3af3d0247b2c798a20c163d1b6331eaaef)
Tested commit: 5db717d
Credit: Henri Salo

./bin/img2sixel -o test libsixel-global-buffer-overflow-stb_image.h-1913-stbi__extend_receive.png
=================================================================
==2715==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f58d30cdcc0 at pc 0x7f58d302a1d1 bp 0x7ffd8fe8f3f0 sp 0x7ffd8fe8f3e8
READ of size 4 at 0x7f58d30cdcc0 thread T0
    #0 0x7f58d302a1d0 in stbi__extend_receive /home/hsalo/src/libsixel/src/stb_image.h:1913
    #1 0x7f58d302a1d0 in stbi__jpeg_decode_block /home/hsalo/src/libsixel/src/stb_image.h:1968
    #2 0x7f58d306a56f in stbi__parse_entropy_coded_data /home/hsalo/src/libsixel/src/stb_image.h:2733
    #3 0x7f58d306a56f in stbi__decode_jpeg_image /home/hsalo/src/libsixel/src/stb_image.h:3132
    #4 0x7f58d306a56f in load_jpeg_image /home/hsalo/src/libsixel/src/stb_image.h:3584
    #5 0x7f58d306a56f in stbi__jpeg_load /home/hsalo/src/libsixel/src/stb_image.h:3741
    #6 0x7f58d306a56f in stbi__load_main /home/hsalo/src/libsixel/src/stb_image.h:980
    #7 0x7f58d307e35c in stbi__load_and_postprocess_8bit /home/hsalo/src/libsixel/src/stb_image.h:1090
    #8 0x7f58d3082663 in load_with_builtin /home/hsalo/src/libsixel/src/loader.c:882
    #9 0x7f58d308f7f8 in sixel_helper_load_image_file /home/hsalo/src/libsixel/src/loader.c:1352
    #10 0x7f58d30b07de in sixel_encoder_encode /home/hsalo/src/libsixel/src/encoder.c:1734
    #11 0x564de83eebab in main /home/hsalo/src/libsixel/converters/img2sixel.c:457
    #12 0x7f58d22372e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #13 0x564de83eede9 in _start (/home/hsalo/builds/libsixel/5db717dfef6fa327cd4025e7352550f63d20699c/bin/img2sixel+0x2de9)

0x7f58d30cdcc0 is located 32 bytes to the left of global variable 'stbi__bmask' defined in 'stb_image.h:1844:27' (0x7f58d30cdce0) of size 68
0x7f58d30cdcc0 is located 0 bytes to the right of global variable 'stbi__jbias' defined in 'stb_image.h:1897:18' (0x7f58d30cdc80) of size 64
SUMMARY: AddressSanitizer: global-buffer-overflow /home/hsalo/src/libsixel/src/stb_image.h:1913 in stbi__extend_receive
Shadow bytes around the buggy address:
  0x0feb9a611b40: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
  0x0feb9a611b50: 00 00 00 00 f9 f9 f9 f9 00 00 00 00 00 00 00 00
  0x0feb9a611b60: 00 00 00 00 00 00 00 04 f9 f9 f9 f9 00 00 00 00
  0x0feb9a611b70: 00 00 00 00 00 00 00 00 00 00 00 04 f9 f9 f9 f9
  0x0feb9a611b80: 00 00 00 00 00 00 00 00 00 07 f9 f9 f9 f9 f9 f9
=>0x0feb9a611b90: 00 00 00 00 00 00 00 00[f9]f9 f9 f9 00 00 00 00
  0x0feb9a611ba0: 00 00 00 00 04 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x0feb9a611bb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0feb9a611bc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0feb9a611bd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0feb9a611be0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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
==2715==ABORTING
@saitoha saitoha self-assigned this Jul 22, 2018
saitoha added a commit that referenced this issue Jul 22, 2018
@saitoha saitoha added the bug label Jul 22, 2018
@saitoha
Copy link
Owner

saitoha commented Jul 22, 2018

@fgeek thank you!

@saitoha saitoha closed this as completed Jul 22, 2018
@fgeek
Copy link
Author

fgeek commented Jul 22, 2018

Happy to help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants