changeset 11453:4e1447ac5301 libavcodec

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.
author conrad
date Wed, 10 Mar 2010 00:59:32 +0000
parents d5673aafc6bf
children 6c4e7bdce257
files vp3.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/vp3.c	Tue Mar 09 23:37:45 2010 +0000
+++ b/vp3.c	Wed Mar 10 00:59:32 2010 +0000
@@ -941,7 +941,7 @@
     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 */