aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-17 22:39:32 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-17 22:39:32 +0100
commit7a7b77e6c97aabb654414044a000e8c4e9d52575 (patch)
tree947e09bb5fa85d2baaa077682facfe33f48857d9
parent3d5c0ba816b97d45ccba229ed1a0ff9d82952e1e (diff)
parent31dc73e92a96f08d07650c0e7d31c0b9a1465d46 (diff)
downloadffmpeg-7a7b77e6c97aabb654414044a000e8c4e9d52575.tar.gz
Merge commit '31dc73e92a96f08d07650c0e7d31c0b9a1465d46'
* commit '31dc73e92a96f08d07650c0e7d31c0b9a1465d46': vorbisdec: Check memory allocations Conflicts: libavcodec/vorbisdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/vorbisdec.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 0953b969bb..d05a48a744 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -379,10 +379,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_array(used_entries,
- codebook_setup->dimensions *
- sizeof(*codebook_setup->codevectors))
- : NULL;
+ if (used_entries) {
+ codebook_setup->codevectors =
+ 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;