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

null pointer dereference in BitmapHook #72

Closed
sleicasper opened this issue May 29, 2022 · 4 comments
Closed

null pointer dereference in BitmapHook #72

sleicasper opened this issue May 29, 2022 · 4 comments

Comments

@sleicasper
Copy link

There is a null pointer dereference in BitmapHook in bitmaphook.cpp.

stack trace

==32572==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000074 (pc 0x7f889cc5dedd bp 0x000000000000 sp 0x7ffd95055cc0 T0)
==32572==The signal is caused by a READ memory access.
==32572==Hint: address points to the zero page.
    #0 0x7f889cc5dedc in fputc /build/glibc-SzIz7B/glibc-2.31/libio/fputc.c:32
    #1 0x560a4361d4b4 in BitmapHook(JPG_Hook*, JPG_TagItem*) /home/casper/targets/struct/libjpeg_th/dbg/SRC/cmd/bitmaphook.cpp:317
    #2 0x560a436326b5 in JPG_Hook::CallLong(JPG_TagItem*) ../interface/hooks.hpp:164
    #3 0x560a43645440 in BitMapHook::Release(JPG_Hook*, JPG_TagItem*, unsigned char, RectAngle<int> const&, ImageBitMap const*, Component const*, bool) /home/casper/targets/struct/libjpeg_th/dbg/SRC/interface/bitmaphook.cpp:239
    #4 0x560a436455b6 in BitMapHook::ReleaseClientData(RectAngle<int> const&, ImageBitMap const*, Component const*) /home/casper/targets/struct/libjpeg_th/dbg/SRC/interface/bitmaphook.cpp:262
    #5 0x560a439219e9 in BitmapCtrl::ReleaseUserData(BitMapHook*, RectAngle<int> const&, unsigned char, bool) /home/casper/targets/struct/libjpeg_th/dbg/SRC/control/bitmapctrl.cpp:193
    #6 0x560a43922018 in BitmapCtrl::ReleaseUserDataFromDecoding(BitMapHook*, RectangleRequest const*, bool) /home/casper/targets/struct/libjpeg_th/dbg/SRC/control/bitmapctrl.cpp:256
    #7 0x560a43661b9b in Image::ReconstructRegion(BitMapHook*, RectangleRequest const*) /home/casper/targets/struct/libjpeg_th/dbg/SRC/codestream/image.cpp:1117
    #8 0x560a4364a1e1 in JPEG::InternalDisplayRectangle(JPG_TagItem*) /home/casper/targets/struct/libjpeg_th/dbg/SRC/interface/jpeg.cpp:721
    #9 0x560a43649ed1 in JPEG::DisplayRectangle(JPG_TagItem*) /home/casper/targets/struct/libjpeg_th/dbg/SRC/interface/jpeg.cpp:699
    #10 0x560a4362ce98 in Reconstruct(char const*, char const*, int, char const*, bool) /home/casper/targets/struct/libjpeg_th/dbg/SRC/cmd/reconstruct.cpp:281
    #11 0x560a43619ea9 in main /home/casper/targets/struct/libjpeg_th/dbg/SRC/cmd/main.cpp:747
    #12 0x7f889cbf7082 in __libc_start_main ../csu/libc-start.c:308
    #13 0x560a436169ad in _start (/home/casper/targets/struct/libjpeg_th/dbg/SRC/jpeg+0x459ad)

poc:
poc.zip

reproduce:

  1. compile libjpeg with address sanitizer
  2. run ./jpeg ./poc /dev/null
@thorfdbg
Copy link
Owner

thorfdbg commented May 30, 2022 via email

@sleicasper
Copy link
Author

Hi,
I can reproduce this issue on latest version from github using command ./jpeg poc /dev/null.

@thorfdbg
Copy link
Owner

thorfdbg commented May 30, 2022 via email

@thorfdbg
Copy link
Owner

Done

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

No branches or pull requests

2 participants