Browse Source

jpeg2000dec: read and check curtileno

Fixes out of array accesses
Code ported from j2kdec

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.0
Michael Niedermayer 12 years ago
parent
commit
fec8783883
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      libavcodec/jpeg2000dec.c

+ 5
- 1
libavcodec/jpeg2000dec.c View File

@@ -416,7 +416,11 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
if (bytestream2_get_bytes_left(&s->g) < 8)
return AVERROR(EINVAL);

Isot = bytestream2_get_be16u(&s->g); // Isot
s->curtileno = Isot = bytestream2_get_be16u(&s->g); // Isot
if((unsigned)s->curtileno >= s->numXtiles * s->numYtiles){
s->curtileno=0;
return AVERROR(EINVAL);
}
if (Isot) {
av_log(s->avctx, AV_LOG_ERROR,
"Not a DCINEMA JP2K file: more than one tile\n");


Loading…
Cancel
Save