diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-03-28 10:09:36 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-04-04 07:54:27 +0200 |
commit | b88f902125ee808c8366e9dcb3f21e4c227483fc (patch) | |
tree | 87349a29233ce618deb7e2f692dad8f3a2641a01 | |
parent | 8d617b11cfc87b2c6056fee029ac5bc760af874a (diff) | |
download | ffmpeg-b88f902125ee808c8366e9dcb3f21e4c227483fc.tar.gz |
bmv: check for len being valid in bmv_decode_frame().
It can be 0 or -1 for invalid files, which may result in invalid memory
access.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
-rw-r--r-- | libavcodec/bmv.c | 2 |
1 files changed, 1 insertions, 1 deletions
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: |