avcodec/jpeg2000dec: non zero image offsets are not supported
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 26 Oct 2013 00:19:13 +0000 (02:19 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 24 Dec 2013 00:05:47 +0000 (01:05 +0100)
Fixes out of array accesses
Fixes Ticket3080
Found-by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 780669ef7c23c00836a24921fcc6b03be2b8ca4a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeg2000dec.c

index 5730b3c..66abd59 100644 (file)
@@ -243,6 +243,11 @@ static int get_siz(Jpeg2000DecoderContext *s)
     s->tile_offset_y  = bytestream2_get_be32u(&s->g); // YT0Siz
     ncomponents       = bytestream2_get_be16u(&s->g); // CSiz
 
+    if (s->image_offset_x || s->image_offset_y) {
+        avpriv_request_sample(s->avctx, "Support for image offsets");
+        return AVERROR_PATCHWELCOME;
+    }
+
     if (ncomponents <= 0) {
         av_log(s->avctx, AV_LOG_ERROR, "Invalid number of components: %d\n",
                s->ncomponents);