[FFmpeg-devel] [PATCH] lavf/vsrc_testsrc: fix SMPTE segfault with small output size

Josh de Kock josh at itanimul.li
Thu Dec 15 13:57:49 EET 2016


The memset (line 1336) in draw_bar is passed a negative size if the output width is less than 36 pixels

Signed-off-by: Josh de Kock <josh at itanimul.li>
---
 libavfilter/vsrc_testsrc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 08f6e07..9f2e91f 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -1413,6 +1413,11 @@ static av_cold int smptebars_init(AVFilterContext *ctx)
 {
     TestSourceContext *test = ctx->priv;
 
+    if (test->w < 36 || test->h < 1) {
+        av_log(ctx, AV_LOG_FATAL, "Size should be 36x1 or larger (%dx%d).\n", test->w, test->h);
+        return AVERROR(EINVAL);
+    }
+
     test->fill_picture_fn = smptebars_fill_picture;
     test->draw_once = 1;
     return init(ctx);
-- 
2.10.1 (Apple Git-78)



More information about the ffmpeg-devel mailing list