diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index b6b685b556..941051ba7f 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -135,7 +135,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, mode += 1 + advance_mode; if (mode >= 4) mode -= 3; - if (FFABS(dst_end - dst) < len) + if (len <= 0 || FFABS(dst_end - dst) < len) return AVERROR_INVALIDDATA; switch (mode) { case 1: