[FFmpeg-cvslog] motionpixels: clip VLC codes.

Anton Khirnov git at videolan.org
Fri Nov 22 12:27:26 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Nov 15 15:33:20 2013 +0100| [ca41c72c6d9515d9045bd3b68104525dee81b8d0] | committer: Anton Khirnov

motionpixels: clip VLC codes.

Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable at libav.org

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca41c72c6d9515d9045bd3b68104525dee81b8d0
---

 libavcodec/motionpixels.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index 8e7b3a4..6c1efad 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;
 }
 



More information about the ffmpeg-cvslog mailing list