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; }