[FFmpeg-cvslog] r22416 - trunk/libavcodec/vp3.c

conrad subversion
Wed Mar 10 01:59:33 CET 2010


Author: conrad
Date: Wed Mar 10 01:59:32 2010
New Revision: 22416

Log:
vp3: avoid buffer overread in coeff decode

I couldn't measure it to be slower for normal interframe videos.
For the worst case, high-bitrate intra-only videos, it can be 0.7% slower.

Modified:
   trunk/libavcodec/vp3.c

Modified: trunk/libavcodec/vp3.c
==============================================================================
--- trunk/libavcodec/vp3.c	Wed Mar 10 00:37:45 2010	(r22415)
+++ trunk/libavcodec/vp3.c	Wed Mar 10 01:59:32 2010	(r22416)
@@ -941,7 +941,7 @@ static int unpack_vlcs(Vp3DecodeContext 
     if (blocks_ended)
         dct_tokens[j++] = blocks_ended << 2;
 
-    while (coeff_i < num_coeffs) {
+    while (coeff_i < num_coeffs && get_bits_left(gb) > 0) {
             /* decode a VLC into a token */
             token = get_vlc2(gb, vlc_table, 5, 3);
             /* use the token to get a zero run, a coefficient, and an eob run */



More information about the ffmpeg-cvslog mailing list