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) ...@@ -369,10 +369,15 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
} }
// Weed out unused vlcs and build codevector vector // Weed out unused vlcs and build codevector vector
codebook_setup->codevectors = used_entries ? av_mallocz(used_entries * if (used_entries) {
codebook_setup->dimensions * codebook_setup->codevectors =
sizeof(*codebook_setup->codevectors)) av_mallocz(used_entries * codebook_setup->dimensions *
: NULL; sizeof(*codebook_setup->codevectors));
if (!codebook_setup->codevectors)
return AVERROR(ENOMEM);
} else
codebook_setup->codevectors = NULL;
for (j = 0, i = 0; i < entries; ++i) { for (j = 0, i = 0; i < entries; ++i) {
unsigned dim = codebook_setup->dimensions; 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