[FFmpeg-cvslog] avcodec/jpeg2000dec: Check tile offsets

Michael Niedermayer git at videolan.org
Tue Jun 6 01:04:34 EEST 2017


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Wed May 24 19:40:42 2017 +0200| [75d32ff24d3076e72d9cf86dd281586ffd7a84d1] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit 89325417e7b33f4b08171d9d609c48662d96b2d3)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75d32ff24d3076e72d9cf86dd281586ffd7a84d1
---

 libavcodec/jpeg2000dec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index c4705cfc78..afa7837077 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -297,6 +297,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) {



More information about the ffmpeg-cvslog mailing list