diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index bbe4ce2888..6619b98301 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -255,6 +255,8 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height segments = bytestream2_get_le16(gb); } line_ptr = frame; + if (frame_end - frame < width) + return AVERROR_INVALIDDATA; frame += width; y++; while (segments--) {