Commit 3db3fdf4 authored by Laurent Aimar's avatar Laurent Aimar Committed by Janne Grunau

xan: Check for out of bound reads in xan_huffman_decode()

Signed-off-by: 's avatarJanne Grunau <janne-libav@jannau.net>
parent 3e0757c2
...@@ -112,7 +112,10 @@ static int xan_huffman_decode(unsigned char *dest, int dest_len, ...@@ -112,7 +112,10 @@ static int xan_huffman_decode(unsigned char *dest, int dest_len,
init_get_bits(&gb, ptr, ptr_len * 8); init_get_bits(&gb, ptr, ptr_len * 8);
while ( val != 0x16 ) { 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 ( val < 0x16 ) {
if (dest >= dest_end) if (dest >= dest_end)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment