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 point dereference in function imagetobmp of convertbmp.c #856

Open
YangY-Xiao opened this issue Oct 29, 2016 · 7 comments
Open

NULL point dereference in function imagetobmp of convertbmp.c #856

YangY-Xiao opened this issue Oct 29, 2016 · 7 comments

Comments

@YangY-Xiao
Copy link

YangY-Xiao commented Oct 29, 2016

DESCRIPTION
OPENJPEG null ptr dereference in convertbmp.c:980

VERSION
OPENJPEG-2.1.2

Address Sanitizer Output
==12736==ERROR: AddressSanitizer: SEGV on unknown address 0x00000f50 (pc 0x08150cc0 bp 0xbfad5d28 sp 0xbfad5cc0 T0)
#0 0x8150cbf (/home/yang/openjpeg/openjpeg-2.1.2/build-clang/bin/opj_decompress+0x8150cbf)
#1 0x81371b8 (/home/yang/openjpeg/openjpeg-2.1.2/build-clang/bin/opj_decompress+0x81371b8)
#2 0xb74a1636 (/lib/i386-linux-gnu/libc.so.6+0x18636)
#3 0x805f327 (/home/yang/openjpeg/openjpeg-2.1.2/build-clang/bin/opj_decompress+0x805f327)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/yang/openjpeg/openjpeg-2.1.2/build-clang/bin/opj_decompress+0x8150cbf)

GDB Information
Program received signal SIGSEGV, Segmentation fault.
0x08055b57 in imagetobmp (image=0x93b15c0, outfile=0xbfa3efd4 "image.bmp") at /home/yang/openjpeg/openjpeg-2.1.2/src/bin/jp2/convertbmp.c:980
980 r = image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
(rr) p image->comps[0].data
$1 = (OPJ_INT32 *) 0x0

Analysis
step1: p_image_dest->comps[compno].data = NULL (image.c:185)
step2: opj_j2k_exec (p_j2k,p_j2k->m_procedure_list,p_stream,p_manager) (j2k.c:9969) ->
opj_j2k_decode_tiles(j2k.c:9723) -> opj_j2k_read_tile_header(j2k.c:7845)
p_j2k->m_specific_param.m_decoder.m_can_decode = 0 => p_go_on = 0 => l_go_on = 0(j2k.c:9756)
p_image_dest->comps[0].data was not assigned a value.
step3: convertbmp.c:980 the program accesses image->comps[0].data
However data is still NULL

Poc
Contact me if you need Poc file at YangX92@hotmail.com

@YangY-Xiao YangY-Xiao changed the title NULL point derefence in function imagetobmp of convertbmp.c NULL point dereference in function imagetobmp of convertbmp.c Oct 29, 2016
@1ucian0
Copy link

1ucian0 commented Dec 3, 2016

Please, refer to this issue as CVE-2016-9113

@rouault
Copy link
Collaborator

rouault commented Aug 9, 2017

@Young-X Please verify if that occurs still with latest master. If so, please attach the reproducer to the ticket

@carnil
Copy link

carnil commented Sep 23, 2017

@Young-X can you please provide the reproducer?

@malaterre
Copy link
Collaborator

@Young-X are you still reading your github updates ?

@carnil
Copy link

carnil commented Oct 3, 2017

@Young-X ping?

@YangY-Xiao
Copy link
Author

Sorry for replying late.
I test the poc with the latest version. There is no crash.

@carnil
Copy link

carnil commented Oct 29, 2017 via email

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

5 participants