diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c index 57ce70e945..9a53cad9cb 100644 --- a/libavcodec/notchlc.c +++ b/libavcodec/notchlc.c @@ -496,6 +496,9 @@ static int decode_frame(AVCodecContext *avctx, bytestream2_init(gb, s->lzf_buffer, uncompressed_size); } else if (s->format == 1) { + if (bytestream2_get_bytes_left(gb) < uncompressed_size / 255) + return AVERROR_INVALIDDATA; + av_fast_padded_malloc(&s->uncompressed_buffer, &s->uncompressed_size, uncompressed_size); if (!s->uncompressed_buffer)