motionpixels: Prevent calling init_vlc() with invalid parameters

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
(cherry picked from commit 1cd0a5516396bd6fb54e4df1e7c88ed18416299b)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Laurent Aimar 2011-09-29 03:12:07 +00:00 committed by Reinhard Tartler
parent 737bea21b6
commit 5fa8e43b54

View File

@ -281,6 +281,8 @@ static int mp_decode_frame(AVCodecContext *avctx,
if (sz == 0)
goto end;
if (mp->max_codes_bits <= 0)
goto end;
if (init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0))
goto end;
mp_decode_frame_helper(mp, &gb);