Mercurial > libavcodec.hg
comparison flacdec.c @ 9133:c78af85f414d libavcodec
flacdec: Add a check for small buffer size. This ensures reading as
much of the frame header as possible without excluding the smallest
possible FLAC frame. It also fixes a false positive warning message
that was being emitted at the end of decoding.
author | jbr |
---|---|
date | Wed, 04 Mar 2009 23:55:10 +0000 |
parents | 37bb2785a35b |
children | e82d5e006de5 |
comparison
equal
deleted
inserted
replaced
9132:37bb2785a35b | 9133:c78af85f414d |
---|---|
637 } | 637 } |
638 } | 638 } |
639 | 639 |
640 init_get_bits(&s->gb, buf, buf_size*8); | 640 init_get_bits(&s->gb, buf, buf_size*8); |
641 | 641 |
642 /* check that there is at least the smallest decodable amount of data. | |
643 this amount corresponds to the smallest valid FLAC frame possible. */ | |
644 if (buf_size < 24) | |
645 goto end; | |
646 | |
642 /* check for inline header */ | 647 /* check for inline header */ |
643 if (show_bits_long(&s->gb, 32) == MKBETAG('f','L','a','C')) { | 648 if (show_bits_long(&s->gb, 32) == MKBETAG('f','L','a','C')) { |
644 if (metadata_parse(s)) { | 649 if (metadata_parse(s)) { |
645 av_log(s->avctx, AV_LOG_ERROR, "invalid header\n"); | 650 av_log(s->avctx, AV_LOG_ERROR, "invalid header\n"); |
646 return -1; | 651 return -1; |