Commit 95a57d26 authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Luca Barbato

jpeg2000: Use the matching coding style struct for transform selection

Fixes a null pointer dereference.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent c4604b87
...@@ -1160,6 +1160,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, ...@@ -1160,6 +1160,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
if (s->precision <= 8) { if (s->precision <= 8) {
for (compno = 0; compno < s->ncomponents; compno++) { for (compno = 0; compno < s->ncomponents; compno++) {
Jpeg2000Component *comp = tile->comp + compno; Jpeg2000Component *comp = tile->comp + compno;
Jpeg2000CodingStyle *codsty = tile->codsty + compno;
float *datap = comp->f_data; float *datap = comp->f_data;
int32_t *i_datap = comp->i_data; int32_t *i_datap = comp->i_data;
int cbps = s->cbps[compno]; int cbps = s->cbps[compno];
...@@ -1173,7 +1174,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, ...@@ -1173,7 +1174,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
x = tile->comp[compno].coord[0][0] - s->image_offset_x; x = tile->comp[compno].coord[0][0] - s->image_offset_x;
dst = line + x * s->ncomponents + compno; dst = line + x * s->ncomponents + compno;
if (tile->codsty->transform == FF_DWT97) { if (codsty->transform == FF_DWT97) {
for (; x < w; x += s->cdx[compno]) { for (; x < w; x += s->cdx[compno]) {
int val = lrintf(*datap) + (1 << (cbps - 1)); int val = lrintf(*datap) + (1 << (cbps - 1));
/* DC level shift and clip see ISO 15444-1:2002 G.1.2 */ /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */
...@@ -1198,6 +1199,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, ...@@ -1198,6 +1199,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
} else { } else {
for (compno = 0; compno < s->ncomponents; compno++) { for (compno = 0; compno < s->ncomponents; compno++) {
Jpeg2000Component *comp = tile->comp + compno; Jpeg2000Component *comp = tile->comp + compno;
Jpeg2000CodingStyle *codsty = tile->codsty + compno;
float *datap = comp->f_data; float *datap = comp->f_data;
int32_t *i_datap = comp->i_data; int32_t *i_datap = comp->i_data;
uint16_t *linel; uint16_t *linel;
...@@ -1210,7 +1212,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, ...@@ -1210,7 +1212,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
uint16_t *dst; uint16_t *dst;
x = tile->comp[compno].coord[0][0] - s->image_offset_x; x = tile->comp[compno].coord[0][0] - s->image_offset_x;
dst = linel + (x * s->ncomponents + compno); dst = linel + (x * s->ncomponents + compno);
if (tile->codsty->transform == FF_DWT97) { if (codsty->transform == FF_DWT97) {
for (; x < w; x += s-> cdx[compno]) { for (; x < w; x += s-> cdx[compno]) {
int val = lrintf(*datap) + (1 << (cbps - 1)); int val = lrintf(*datap) + (1 << (cbps - 1));
/* DC level shift and clip see ISO 15444-1:2002 G.1.2 */ /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment