Merge commit '31dc73e92a96f08d07650c0e7d31c0b9a1465d46'

* commit '31dc73e92a96f08d07650c0e7d31c0b9a1465d46':
  vorbisdec: Check memory allocations

Conflicts:
	libavcodec/vorbisdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-02-17 22:39:32 +01:00
commit 7a7b77e6c9
1 changed files with 9 additions and 4 deletions

View File

@ -379,10 +379,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_array(used_entries, if (used_entries) {
codebook_setup->dimensions * codebook_setup->codevectors =
sizeof(*codebook_setup->codevectors)) av_mallocz_array(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;