[FFmpeg-cvslog] r17798 - trunk/libavcodec/flacdec.c

jbr subversion
Wed Mar 4 02:08:27 CET 2009


Author: jbr
Date: Wed Mar  4 02:08:26 2009
New Revision: 17798

Log:
flacdec: When there is not enough data to read the next header block, 
reset the bitstream reader instead of skipping backwards.

Modified:
   trunk/libavcodec/flacdec.c

Modified: trunk/libavcodec/flacdec.c
==============================================================================
--- trunk/libavcodec/flacdec.c	Wed Mar  4 01:57:37 2009	(r17797)
+++ trunk/libavcodec/flacdec.c	Wed Mar  4 02:08:26 2009	(r17798)
@@ -229,7 +229,6 @@ void ff_flac_parse_streaminfo(AVCodecCon
 static int metadata_parse(FLACContext *s)
 {
     int i, metadata_last, metadata_type, metadata_size;
-    int initial_pos= get_bits_count(&s->gb);
 
     skip_bits_long(&s->gb, 32);
 
@@ -239,7 +238,8 @@ static int metadata_parse(FLACContext *s
         metadata_size = get_bits_long(&s->gb, 24);
 
         if (get_bits_count(&s->gb) + 8*metadata_size > s->gb.size_in_bits) {
-            skip_bits_long(&s->gb, initial_pos - get_bits_count(&s->gb));
+            /* need more data. reset the bitstream reader and return. */
+            init_get_bits(&s->gb, s->gb.buffer, s->gb.size_in_bits);
             break;
         }
 




More information about the ffmpeg-cvslog mailing list