Commit 31dc73e9 authored by Vittorio Giovara's avatar Vittorio Giovara

vorbisdec: Check memory allocations

parent ec17782e
......@@ -369,10 +369,15 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
}
// Weed out unused vlcs and build codevector vector
codebook_setup->codevectors = used_entries ? av_mallocz(used_entries *
codebook_setup->dimensions *
sizeof(*codebook_setup->codevectors))
: NULL;
if (used_entries) {
codebook_setup->codevectors =
av_mallocz(used_entries * codebook_setup->dimensions *
sizeof(*codebook_setup->codevectors));
if (!codebook_setup->codevectors)
return AVERROR(ENOMEM);
} else
codebook_setup->codevectors = NULL;
for (j = 0, i = 0; i < entries; ++i) {
unsigned dim = codebook_setup->dimensions;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment