From 035683a38496569c9b79e2421682607c678a0a8b Mon Sep 17 00:00:00 2001
From: Daniel Kang <daniel.d.kang@gmail.com>
Date: Sun, 2 Jan 2011 20:42:07 -0500
Subject: [PATCH] Sanity check to see if malloc returns the right size.

---
 libavformat/ape.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/ape.c b/libavformat/ape.c
index 91acf72..225f00b 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -247,7 +247,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
         return -1;
     }
     ape->frames       = av_malloc(ape->totalframes * sizeof(APEFrame));
-    if(!ape->frames)
+    if(!ape->frames || sizeof(ape->frames) != ape->totalframes * sizeof(APEFrame))
         return AVERROR(ENOMEM);
     ape->firstframe   = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength;
     ape->currentframe = 0;
--
1.7.2.2

