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

Heap-buffer-overflow in opj_dwt_decode #486

Closed
gcode-importer opened this issue Apr 17, 2015 · 0 comments
Closed

Heap-buffer-overflow in opj_dwt_decode #486

gcode-importer opened this issue Apr 17, 2015 · 0 comments

Comments

@gcode-importer
Copy link

Originally reported on Google Code with ID 486

What steps will reproduce the problem?
1. Run Opj_decompress with the attached as input

What is the expected output? What do you see instead?
In ASAN environment, it triggers Heap-buffer-overflow in opj_dwt_decode.

What version of the product are you using? On what operating system?
OpenJpeg revision 2997. Ubuntu 64 bits and Windows 7.

Please provide any additional information below.
The original issue was raised in  https://code.google.com/p/chromium/issues/list. It's
issue 457480.

If there is no ASAN environment, we still can find this issue with debugging mode.
Please input repro.jp2 to run Opj_decompress. 

Set two breaking points in the following two functions to check the address. we can
find h.mem points to 4 bytes memory. But bi points to the memory out of the allocated
range. It causes Heap-buffer-overflow when *bi is assigned to some values.

OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN
dwt_1D) {

        ...
    h.mem = (OPJ_INT32*)
    opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
        ...
}


void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
    ...
    bi  = h->mem + 1 - h->cas;
    ...
} 

Reported by [email protected] on 2015-04-17 23:19:52


- _Attachment: [repro.jp2](https://storage.googleapis.com/google-code-attachments/openjpeg/issue-486/comment-0/repro.jp2)_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants