xxan: don't read before start of buffer in av_memcpy_backptr().
authorRonald S. Bultje <rsbultje@gmail.com>
Fri, 9 Mar 2012 00:32:46 +0000 (16:32 -0800)
committerReinhard Tartler <siretart@tauware.de>
Sun, 1 Apr 2012 16:33:29 +0000 (18:33 +0200)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f1279e286b00e99f343adb51e251f036a3df6f32)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/xxan.c

index 28c868d..daaba63 100644 (file)
@@ -129,7 +129,8 @@ static int xan_unpack(uint8_t *dest, const int dest_len,
                 if (size + size2 > dest_end - dest)
                     break;
             }
-            if (src + size > src_end || dest + size + size2 > dest_end)
+            if (src + size > src_end || dest + size + size2 > dest_end ||
+                dest - orig_dest + size < back)
                 return -1;
             bytestream_get_buffer(&src, dest, size);
             dest += size;