aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-15 15:33:20 +0100
committerReinhard Tartler <siretart@tauware.de>2014-01-05 17:13:08 -0500
commit26221a54eca391de29557fc08c32d23a40ef4d32 (patch)
treefae814c7e44ce6dc26b448a209786a6996c1e66d /libavcodec
parent7c214e313c92e8e9f125c0ab74902bdd5ae2e153 (diff)
downloadffmpeg-26221a54eca391de29557fc08c32d23a40ef4d32.tar.gz
motionpixels: clip VLC codes.
Fixes invalid reads. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org (cherry picked from commit ca41c72c6d9515d9045bd3b68104525dee81b8d0) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/motionpixels.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index c2bd0f4d2b..4c0b98be91 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -159,6 +159,7 @@ static int mp_get_vlc(MotionPixelsContext *mp, GetBitContext *gb)
int i;
i = (mp->codes_count == 1) ? 0 : get_vlc2(gb, mp->vlc.table, mp->max_codes_bits, 1);
+ i = FFMIN(i, FF_ARRAY_ELEMS(mp->codes) - 1);
return mp->codes[i].delta;
}