wmalosslessdec: Reset put bit buffer when num_saved_bits is reset.
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 14 Apr 2012 14:32:56 +0000 (16:32 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 14 Apr 2012 14:33:42 +0000 (16:33 +0200)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/wmalosslessdec.c

index 3b68cca..bac064f 100644 (file)
@@ -1224,6 +1224,7 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
             /* Reset number of saved bits so that the decoder does not start
              * to decode incomplete frames in the s->len_prefix == 0 case. */
             s->num_saved_bits = 0;
+            init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
             s->packet_loss    = 0;
         }
 
@@ -1273,6 +1274,7 @@ static void flush(AVCodecContext *avctx)
     s->packet_loss       = 1;
     s->packet_done       = 0;
     s->num_saved_bits    = 0;
+    init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
     s->frame_offset      = 0;
     s->next_packet_start = 0;
     s->cdlms[0][0].order = 0;