summaryrefslogtreecommitdiff
path: root/libavcodec/xan.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-28 00:45:54 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-29 23:21:15 +0200
commitc8b835954ae4aef797112afda3b52f8dfe3c7b74 (patch)
tree7912c4e7ac8aabf4f2b266d59773654533c2369c /libavcodec/xan.c
parent7afe23808a2ce782f834ec39f0738e7f7bcf5bd5 (diff)
Check for out of bound reads in xan_huffman_decode() of the xan decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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 fe11ac3f7a..21b5302000 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -114,7 +114,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)