vorbisdec: check codebook entry count

Fixes assertion failure

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-05-13 14:19:57 +02:00
parent 3a4c8788e3
commit e6b6ae4695
1 changed files with 5 additions and 0 deletions

View File

@ -422,6 +422,11 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
} }
// Initialize VLC table // 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)) { 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"); av_log(vc->avctx, AV_LOG_ERROR, " Invalid code lengths while generating vlcs. \n");
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;