From e6b6ae46951e242d7caf11acf5b1f10f109e1c96 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 13 May 2013 14:19:57 +0200 Subject: [PATCH] vorbisdec: check codebook entry count Fixes assertion failure Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/vorbisdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index f30745d7ae..ba5b1a3f94 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -422,6 +422,11 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) } // Initialize VLC table + if (entries <= 0) { + av_log(vc->avctx, AV_LOG_ERROR, "Invalid codebook entry count\n"); + ret = AVERROR_INVALIDDATA; + goto error; + } if (ff_vorbis_len2vlc(tmp_vlc_bits, tmp_vlc_codes, entries)) { av_log(vc->avctx, AV_LOG_ERROR, " Invalid code lengths while generating vlcs. \n"); ret = AVERROR_INVALIDDATA;