]> git.sesse.net Git - ffmpeg/commitdiff
mp3dec: hack: fix decoding with safe bitstream reader
authorMans Rullgard <mans@mansr.com>
Sat, 17 Dec 2011 16:19:24 +0000 (16:19 +0000)
committerMans Rullgard <mans@mansr.com>
Sat, 17 Dec 2011 17:51:22 +0000 (17:51 +0000)
The buffer splicing relies on the bitstream reader over-reading
the end of the buffer as declared in init_get_bits(), although
more data is actually present.  Manually moving the bitstream
boundary after init_get_bits() allows this to work as expected.

Signed-off-by: Mans Rullgard <mans@mansr.com>
libavcodec/mpegaudiodec.c

index eeef470a5769f9672605f004583d43a04526c946..0c8f9c787b25be925f51599bef69faf81f26b049 100644 (file)
@@ -1548,6 +1548,9 @@ static int mp_decode_layer3(MPADecodeContext *s)
         memcpy(s->last_buf + s->last_buf_size, ptr, EXTRABYTES);
         s->in_gb = s->gb;
         init_get_bits(&s->gb, s->last_buf, s->last_buf_size*8);
+#if CONFIG_SAFE_BITSTREAM_READER
+        s->gb.size_in_bits_plus8 += EXTRABYTES * 8;
+#endif
         skip_bits_long(&s->gb, 8*(s->last_buf_size - main_data_begin));
     }