summaryrefslogtreecommitdiff
path: root/libavcodec/xxan.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-03-08 16:32:46 -0800
committerRonald S. Bultje <rsbultje@gmail.com>2012-03-10 11:48:39 -0800
commitf1279e286b00e99f343adb51e251f036a3df6f32 (patch)
tree2397455f2308fbf4b34b46cce14f6b8c470e5c89 /libavcodec/xxan.c
parenta928ed375108caf1dc8a0a2a6f42e5f17665e74a (diff)
xxan: don't read before start of buffer in av_memcpy_backptr().
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/xxan.c')
-rw-r--r--libavcodec/xxan.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c
index 4659d34972..8147bad5f1 100644
--- a/libavcodec/xxan.c
+++ b/libavcodec/xxan.c
@@ -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;