xxan: fix invalid memory access in xan_decode_frame_type0()
authorAnton Khirnov <anton@khirnov.net>
Wed, 6 Mar 2013 08:06:16 +0000 (09:06 +0100)
committerReinhard Tartler <siretart@tauware.de>
Sat, 9 Mar 2013 17:54:28 +0000 (18:54 +0100)
The loop a few lines below the xan_unpack() call accesses up to
dec_size * 2 bytes into y_buffer, so dec_size must be limited to
buffer_size / 2.

CC:libav-stable@libav.org
(cherry picked from commit 8a49d2bcbe7573bb4b765728b2578fac0d19763f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 62a657de168cf501acb23d48cc1aa00793dc83f3)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/xxan.c

index 0a37d48..59e1229 100644 (file)
@@ -296,7 +296,7 @@ static int xan_decode_frame_type0(AVCodecContext *avctx)
         if (chroma_off > corr_off)
             corr_end = chroma_off;
         bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET);
-        dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size);
+        dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size / 2);
         if (dec_size < 0)
             dec_size = 0;
         for (i = 0; i < dec_size; i++)