Browse Source

avcodec/jpeg2000dec: Check tile offsets

Fixes: runtime error: signed integer overflow: 4096 - -2147483648 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 89325417e7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.4.14
Michael Niedermayer 8 years ago
parent
commit
d09e4a9e8b
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      libavcodec/jpeg2000dec.c

+ 8
- 0
libavcodec/jpeg2000dec.c View File

@@ -267,6 +267,14 @@ static int get_siz(Jpeg2000DecoderContext *s)
return AVERROR_PATCHWELCOME;
}

if (s->tile_offset_x < 0 || s->tile_offset_y < 0 ||
s->image_offset_x < s->tile_offset_x ||
s->image_offset_y < s->tile_offset_y) {
av_log(s->avctx, AV_LOG_ERROR, "Tile offsets are invalid\n",
s->ncomponents);
return AVERROR_INVALIDDATA;
}

s->ncomponents = ncomponents;

if (s->tile_width <= 0 || s->tile_height <= 0) {


Loading…
Cancel
Save