Merge commit '31dc73e92a96f08d07650c0e7d31c0b9a1465d46'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 17 Feb 2015 21:39:32 +0000 (22:39 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 17 Feb 2015 21:39:32 +0000 (22:39 +0100)
* commit '31dc73e92a96f08d07650c0e7d31c0b9a1465d46':
  vorbisdec: Check memory allocations

Conflicts:
libavcodec/vorbisdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/vorbisdec.c

@@@ -379,10 -369,15 +379,15 @@@ static int vorbis_parse_setup_hdr_codeb
              }
  
  // Weed out unused vlcs and build codevector vector
-             codebook_setup->codevectors = used_entries ? av_mallocz_array(used_entries,
-                                                                     codebook_setup->dimensions *
-                                                                     sizeof(*codebook_setup->codevectors))
-                                                        : NULL;
+             if (used_entries) {
+                 codebook_setup->codevectors =
 -                    av_mallocz(used_entries * codebook_setup->dimensions *
++                    av_mallocz_array(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;