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>
This commit is contained in:
Andreas Rheinhardt 2020-09-23 06:24:03 +02:00
parent 310d4062e7
commit 3c172a2fb9

View 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;
}