diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2009-03-04 23:55:10 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2009-03-04 23:55:10 +0000 |
commit | 5ef4fa87b319ea33dc87c459cbd714f355824218 (patch) | |
tree | ae9af1d6fb613430e2de4dbca2f08b7b3fbf94ee /libavcodec/flacdec.c | |
parent | c51997297a2e8df8339874b14115329bbff576a7 (diff) | |
download | ffmpeg-5ef4fa87b319ea33dc87c459cbd714f355824218.tar.gz |
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.
Originally committed as revision 17816 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flacdec.c')
-rw-r--r-- | libavcodec/flacdec.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 61062b2a84..ee845de115 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -639,6 +639,11 @@ static int flac_decode_frame(AVCodecContext *avctx, init_get_bits(&s->gb, buf, buf_size*8); + /* check that there is at least the smallest decodable amount of data. + this amount corresponds to the smallest valid FLAC frame possible. */ + if (buf_size < 24) + goto end; + /* check for inline header */ if (show_bits_long(&s->gb, 32) == MKBETAG('f','L','a','C')) { if (metadata_parse(s)) { |