Browse Source

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
tags/v0.6
Justin Ruggles 17 years ago
parent
commit
5ef4fa87b3
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavcodec/flacdec.c

+ 5
- 0
libavcodec/flacdec.c View File

@@ -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)) {


Loading…
Cancel
Save