[FFmpeg-cvslog] r17816 - trunk/libavcodec/flacdec.c

jbr subversion
Thu Mar 5 00:55:10 CET 2009


Author: jbr
Date: Thu Mar  5 00:55:10 2009
New Revision: 17816

Log:
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.

Modified:
   trunk/libavcodec/flacdec.c

Modified: trunk/libavcodec/flacdec.c
==============================================================================
--- trunk/libavcodec/flacdec.c	Thu Mar  5 00:24:44 2009	(r17815)
+++ trunk/libavcodec/flacdec.c	Thu Mar  5 00:55:10 2009	(r17816)
@@ -639,6 +639,11 @@ static int flac_decode_frame(AVCodecCont
 
     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)) {




More information about the ffmpeg-cvslog mailing list