aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/flacdec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2009-03-04 01:08:26 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2009-03-04 01:08:26 +0000
commite1374c06d6f68629573b1c79b2f57cc4bb12e768 (patch)
tree0650963b33bf868d85c2eba297d491eeca65baf2 /libavcodec/flacdec.c
parent29b9f58b37ce310965a9d7a50e3abbc582a10f69 (diff)
downloadffmpeg-e1374c06d6f68629573b1c79b2f57cc4bb12e768.tar.gz
flacdec: When there is not enough data to read the next header block,
reset the bitstream reader instead of skipping backwards. Originally committed as revision 17798 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flacdec.c')
-rw-r--r--libavcodec/flacdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 13549d8ccf..b8ae73fea9 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -229,7 +229,6 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
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;
}