Skip to content

Commit

Permalink
Fix segfault in save_bits:
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
faust3 committed Sep 24, 2011
1 parent 43e0568 commit 780d454
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libavcodec/wmaprodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 780d454

Please sign in to comment.