diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-24 19:40:42 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-24 19:41:15 +0200 |
commit | 89325417e7b33f4b08171d9d609c48662d96b2d3 (patch) | |
tree | 7f89001c550b5877ae56b3f6555ed67bdf044499 | |
parent | ca616b0f72c65b0ef5f9e1e6125698b15f50a26e (diff) | |
download | ffmpeg-89325417e7b33f4b08171d9d609c48662d96b2d3.tar.gz |
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>
-rw-r--r-- | libavcodec/jpeg2000dec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index ab814cabe5..d1425654df 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -298,6 +298,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) { |