dfa: Put our pointer check back.
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 4 May 2013 12:37:22 +0000 (14:37 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 4 May 2013 12:42:19 +0000 (14:42 +0200)
The reimplementation by Libav does not prevent out of array
writes, even though it looks like it does at a quick glance.

No FFmpeg releases are affected by this

See: d1c95d2ce39560e251fdb14f4af91b04fd7b845c
     3623589edc7b1257bb45aa9e52c9631e133f22b6
     740ebe468c0567cac03ef7e6b4b9fd0253b97da2

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/dfa.c

index 6a095b2..bba7626 100644 (file)
@@ -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);