dfa: check for invalid access in decode_wdlt().
authorAnton Khirnov <anton@khirnov.net>
Wed, 27 Mar 2013 17:18:38 +0000 (18:18 +0100)
committerAnton Khirnov <anton@khirnov.net>
Thu, 4 Apr 2013 05:54:07 +0000 (07:54 +0200)
This can happen when the number of skipped lines is not consistent with
the number of coded lines.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/dfa.c

index bbe4ce2..6619b98 100644 (file)
@@ -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--) {