X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmagicyuv.c;h=1a129c26198af3645bedbccd647fed2ecf063012;hb=7f22a4ebc97817fd0968f5ea8295c9a59a6292e0;hp=9c6e1ba1b14839b6f74f41d3e7656478d9dc212d;hpb=0dc11d8bbd470db89fbc17b7434e992c9129b310;p=ffmpeg diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c index 9c6e1ba1b14..1a129c26198 100644 --- a/libavcodec/magicyuv.c +++ b/libavcodec/magicyuv.c @@ -240,6 +240,8 @@ static int magy_decode_slice10(AVCodecContext *avctx, void *tdata, dst = (uint16_t *)p->data[i] + j * sheight * stride; if (flags & 1) { + if (get_bits_left(&gb) < bps * width * height) + return AVERROR_INVALIDDATA; for (k = 0; k < height; k++) { for (x = 0; x < width; x++) dst[x] = get_bits(&gb, bps); @@ -368,6 +370,8 @@ static int magy_decode_slice(AVCodecContext *avctx, void *tdata, dst = p->data[i] + j * sheight * stride; if (flags & 1) { + if (get_bits_left(&gb) < 8* width * height) + return AVERROR_INVALIDDATA; for (k = 0; k < height; k++) { for (x = 0; x < width; x++) dst[x] = get_bits(&gb, 8);