diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 6a095b2db9..bba7626cb7 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -254,6 +254,9 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height y += skip_lines; segments = bytestream2_get_le16(gb); } + + if (frame_end <= frame) + return AVERROR_INVALIDDATA; if (segments & 0x8000) { frame[width - 1] = segments & 0xFF; segments = bytestream2_get_le16(gb);