diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2009-03-04 03:52:18 +0300 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2009-03-04 03:52:18 +0300 |
commit | 55a727383bab266b757b642aabaa2b066c14e7c7 (patch) | |
tree | 0161707f380512a788d0d45b0d9e90c04af14b68 /libavcodec/flacdec.c | |
parent | 239b961fbf7e01c58e4bf7df8271d1cbff0417d4 (diff) |
flacdec: Check for an inline header before calling metadata_parse().
Originally committed as revision 17795 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flacdec.c')
-rw-r--r-- | libavcodec/flacdec.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 02f1b36a5c..3a88545368 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -224,14 +224,13 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, * the fLaC marker. * @param s the flac decoding context containing the gb bit reader used to * parse metadata - * @return 1 if some metadata was read, 0 if no fLaC marker was found + * @return non-zero if metadata is invalid */ static int metadata_parse(FLACContext *s) { int i, metadata_last, metadata_type, metadata_size; int initial_pos= get_bits_count(&s->gb); - if (show_bits_long(&s->gb, 32) == MKBETAG('f','L','a','C')) { skip_bits_long(&s->gb, 32); do { @@ -260,8 +259,6 @@ static int metadata_parse(FLACContext *s) } } while (!metadata_last); - return 1; - } return 0; } @@ -642,8 +639,14 @@ static int flac_decode_frame(AVCodecContext *avctx, init_get_bits(&s->gb, buf, buf_size*8); - if (metadata_parse(s)) + /* check for inline header */ + if (show_bits_long(&s->gb, 32) == MKBETAG('f','L','a','C')) { + if (metadata_parse(s)) { + av_log(s->avctx, AV_LOG_ERROR, "invalid header\n"); + return -1; + } goto end; + } tmp = show_bits(&s->gb, 16); if ((tmp & 0xFFFE) != 0xFFF8) { |