]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/magicyuv: Check early for invalid slices
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 23 Sep 2020 04:24:03 +0000 (06:24 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 26 Sep 2020 18:38:30 +0000 (20:38 +0200)
Every plane of each slice has to contain at least two bytes for flags
and the type of prediction used.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/magicyuv.c

index d2f6a9b01e9f37861d865e1baaf1b2c91a828695..6c29efc9f49c18e3fe92e99290ee45160afd9479 100644 (file)
@@ -614,6 +614,8 @@ static int magy_decode_frame(AVCodecContext *avctx, void *data,
                 return AVERROR_INVALIDDATA;
 
             s->slices[i][j].size = next_offset - offset;
+            if (s->slices[i][j].size < 2)
+                return AVERROR_INVALIDDATA;
             offset = next_offset;
         }