summaryrefslogtreecommitdiff
path: root/libavcodec/xan.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-29 20:38:01 +0000
committerJanne Grunau <janne-libav@jannau.net>2011-10-07 16:25:32 +0200
commit3db3fdf4c669aed9379be430c17f151d4d0697c5 (patch)
tree3e78f434460dcd745fdd30df4482e1dc6dc3b6ea /libavcodec/xan.c
parent3e0757c2a87c8cf3e452f67bca279001c64cedff (diff)
xan: Check for out of bound reads in xan_huffman_decode()
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'libavcodec/xan.c')
-rw-r--r--libavcodec/xan.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index c71a718537..3965617838 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -112,7 +112,10 @@ static int xan_huffman_decode(unsigned char *dest, int dest_len,
init_get_bits(&gb, ptr, ptr_len * 8);
while ( val != 0x16 ) {
- val = src[val - 0x17 + get_bits1(&gb) * byte];
+ unsigned idx = val - 0x17 + get_bits1(&gb) * byte;
+ if (idx >= 2 * byte)
+ return -1;
+ val = src[idx];
if ( val < 0x16 ) {
if (dest >= dest_end)