[FFmpeg-cvslog] avcodec/magicyuv: Check early for invalid slices

Andreas Rheinhardt git at videolan.org
Sat Sep 26 22:12:21 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Sep 23 06:24:03 2020 +0200| [3c172a2fb91a758d9e15f09f96879e6e9b5a37ec] | committer: Andreas Rheinhardt

avcodec/magicyuv: Check early for invalid slices

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 at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavcodec/magicyuv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index d2f6a9b01e..6c29efc9f4 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -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;
         }
 



More information about the ffmpeg-cvslog mailing list