]> git.sesse.net Git - ffmpeg/commitdiff
bmv: check for len being valid in bmv_decode_frame().
authorAnton Khirnov <anton@khirnov.net>
Thu, 28 Mar 2013 09:09:36 +0000 (10:09 +0100)
committerAnton Khirnov <anton@khirnov.net>
Thu, 4 Apr 2013 05:54:27 +0000 (07:54 +0200)
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
libavcodec/bmv.c

index b6b685b5569fa27ebb2ac12922832aa7c78ee43f..941051ba7f7aa1a14ae25eb0ddd64edcc46c677b 100644 (file)
@@ -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: