summaryrefslogtreecommitdiff
path: root/libavcodec/vp3.c
diff options
context:
space:
mode:
authorDavid Conrad <lessen42@gmail.com>2010-03-10 00:59:32 +0000
committerDavid Conrad <lessen42@gmail.com>2010-03-10 00:59:32 +0000
commitf50dafa8fcefac0fc3a0e010eb444c1b5acaccc9 (patch)
treea4e8cf4cd8529e78434f28f1f186402dfb657812 /libavcodec/vp3.c
parent2cbc1ec67666eaddfe5f48c029857137d630d60e (diff)
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. Originally committed as revision 22416 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r--libavcodec/vp3.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index ff56be65fe..bcb740970e 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -941,7 +941,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
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 */