aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/magicyuv.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-23 06:24:03 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-26 20:38:30 +0200
commit3c172a2fb91a758d9e15f09f96879e6e9b5a37ec (patch)
tree214efee68273ecd901c5269da507231979774ff1 /libavcodec/magicyuv.c
parent310d4062e7639217d717e447426343366775ac30 (diff)
downloadffmpeg-3c172a2fb91a758d9e15f09f96879e6e9b5a37ec.tar.gz
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@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/magicyuv.c')
-rw-r--r--libavcodec/magicyuv.c2
1 files changed, 2 insertions, 0 deletions
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;
}