[FFmpeg-cvslog] lavfi/ebur128: check histogram allocations.

Clément Bœsch git at videolan.org
Fri Mar 15 02:59:13 CET 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Fri Mar 15 02:58:29 2013 +0100| [1edbeb353222acd204934043cfde9933c173b100] | committer: Clément Bœsch

lavfi/ebur128: check histogram allocations.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1edbeb353222acd204934043cfde9933c173b100
---

 libavfilter/f_ebur128.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 33cea40..6d7f7af 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -373,6 +373,8 @@ static struct hist_entry *get_histogram(void)
     int i;
     struct hist_entry *h = av_calloc(HIST_SIZE, sizeof(*h));
 
+    if (!h)
+        return NULL;
     for (i = 0; i < HIST_SIZE; i++) {
         h[i].loudness = i / (double)HIST_GRAIN + ABS_THRES;
         h[i].energy   = ENERGY(h[i].loudness);
@@ -406,6 +408,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
 
     ebur128->i400.histogram  = get_histogram();
     ebur128->i3000.histogram = get_histogram();
+    if (!ebur128->i400.histogram || !ebur128->i3000.histogram)
+        return AVERROR(ENOMEM);
 
     ebur128->integrated_loudness = ABS_THRES;
     ebur128->loudness_range = 0;



More information about the ffmpeg-cvslog mailing list