Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-10 02:32:12 +0400
committerReinhard Tartler <siretart@tauware.de>2011-12-24 15:20:33 +0400
commita97e82c48762cd0b1faa249cc0ec3469f149c5f0 (patch)
tree1e4f4dc41a46c3172ee37122e970cbd395ec2ab8 /libavcodec
parentf79f3a946f91de62d879b73410d80fd4e55ea28f (diff)
Fixed size given to init_get_bits() in xan decoder.
(cherry picked from commit 393d5031c6aaaf8c2dda4eb5d676974c349fae85) Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/xan.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index 3f6aa8cee5..9f20b7f280 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -88,17 +88,18 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
return 0;
}
-static int xan_huffman_decode(unsigned char *dest, const unsigned char *src,
- int dest_len)
+static int xan_huffman_decode(unsigned char *dest, int dest_len,
+ const unsigned char *src, int src_len)
{
unsigned char byte = *src++;
unsigned char ival = byte + 0x16;
const unsigned char * ptr = src + byte*2;
+ int ptr_len = src_len - 1 - byte*2;
unsigned char val = ival;
unsigned char *dest_end = dest + dest_len;
GetBitContext gb;
- init_get_bits(&gb, ptr, 0); // FIXME: no src size available
+ init_get_bits(&gb, ptr, ptr_len * 8);
while ( val != 0x16 ) {
val = src[val - 0x17 + get_bits1(&gb) * byte];
@@ -263,7 +264,8 @@ static void xan_wc3_decode_frame(XanContext *s) {
vector_segment = s->buf + AV_RL16(&s->buf[4]);
imagedata_segment = s->buf + AV_RL16(&s->buf[6]);
- xan_huffman_decode(opcode_buffer, huffman_segment, opcode_buffer_size);
+ xan_huffman_decode(opcode_buffer, opcode_buffer_size,
+ huffman_segment, s->size - (huffman_segment - s->buf) );
if (imagedata_segment[0] == 2)
xan_unpack(s->buffer2, &imagedata_segment[1], s->buffer2_size);