Skip to content
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.

Commit

Permalink
jp2_dec: fix numchans mixup
Browse files Browse the repository at this point in the history
When iterating over `dec->cdef->data.cdef.ents`, we need to use its
`numchans` variable, not the one in `jp2_dec_t`.

Fixes CVE-2018-19543
Fixes CVE-2017-9782

Closes #13
Closes #18
Closes jasper-software/jasper#140
Closes jasper-software/jasper#182
  • Loading branch information
MaxKellermann committed Jun 28, 2020
1 parent 24453e7 commit 839b1bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libjasper/jp2/jp2_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr)

/* Determine the type of each component. */
if (dec->cdef) {
for (i = 0; i < dec->numchans; ++i) {
for (i = 0; i < dec->cdef->data.cdef.numchans; ++i) {
/* Is the channel number reasonable? */
if (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) {
jas_eprintf("error: invalid channel number in CDEF box\n");
Expand Down

0 comments on commit 839b1bc

Please sign in to comment.