[FFmpeg-cvslog] Fix segfault in save_bits:

Sascha Sommer git at videolan.org
Sat Oct 1 21:38:46 CEST 2011


ffmpeg | branch: release/0.8 | Sascha Sommer <saschasommer at freenet.de> | Sat Sep 24 20:56:41 2011 +0200| [9960710b872e2d1c7d9d8730c4b6ca2c2cdf183e] | committer: Michael Niedermayer

Fix segfault in save_bits:
use put_bits_count to get the buffer fill state instead of
num_saved_bits as num_saved_bits is sometimes reset when
frames are lost
(Ticket 495)
(cherry picked from commit 780d45473c32fa356c8ce385c3ea4692567c3228)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 4f6187c7356111540024901932294e9807061dd0)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9960710b872e2d1c7d9d8730c4b6ca2c2cdf183e
---

 libavcodec/wmaprodec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index e1d942d..b0b98f1 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1436,7 +1436,7 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len,
         init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
     }
 
-    buflen = (s->num_saved_bits + len + 8) >> 3;
+    buflen = (put_bits_count(&s->pb) + len + 8) >> 3;
 
     if (len <= 0 || buflen > MAX_FRAMESIZE) {
         av_log_ask_for_sample(s->avctx, "input buffer too small\n");



More information about the ffmpeg-cvslog mailing list