aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-15 15:33:20 +0100
committerAnton Khirnov <anton@khirnov.net>2013-11-21 20:57:20 +0100
commitca41c72c6d9515d9045bd3b68104525dee81b8d0 (patch)
tree1fff2a0860661939b454f901a99dfddc72f6fc0e /libavcodec
parent8b516f154a0a08655cec2d13d12aadc58cae0b1c (diff)
downloadffmpeg-ca41c72c6d9515d9045bd3b68104525dee81b8d0.tar.gz
motionpixels: clip VLC codes.
Fixes invalid reads. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
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 8e7b3a4131..6c1efadd56 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -180,6 +180,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;
}