lavfi/avf_showspectrum: check RDFT context init.
authorNicolas George <george@nsup.org>
Sun, 3 Aug 2014 18:39:59 +0000 (20:39 +0200)
committerNicolas George <george@nsup.org>
Thu, 14 Aug 2014 13:11:39 +0000 (15:11 +0200)
Fix a segfault with large window size.

libavfilter/avf_showspectrum.c

index 9130f6f..bd4d818 100644 (file)
@@ -177,6 +177,11 @@ static int config_output(AVFilterLink *outlink)
 
         av_rdft_end(s->rdft);
         s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
+        if (!s->rdft) {
+            av_log(ctx, AV_LOG_ERROR, "Unable to create RDFT context. "
+                   "The window size might be too high.\n");
+            return AVERROR(EINVAL);
+        }
         s->rdft_bits = rdft_bits;
 
         /* RDFT buffers: x2 for each (display) channel buffer.