From a80f53d91fc1d3c523b4660a4f7ca3ede82f0bd8 Mon Sep 17 00:00:00 2001
From: happyworker <208suo@208suo.com>
Date: Wed, 19 Jun 2024 14:48:11 +0800
Subject: [PATCH] Fix CVE-2023-51794

---
 libavfilter/af_stereowiden.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/af_stereowiden.c b/libavfilter/af_stereowiden.c
index d23c8db..3d7b5bb 100644
--- a/libavfilter/af_stereowiden.c
+++ b/libavfilter/af_stereowiden.c
@@ -74,6 +74,8 @@ static int config_input(AVFilterLink *inlink)
 
     s->length = s->delay * inlink->sample_rate / 1000;
     s->length *= 2;
+    if (s->length == 0)
+	return AVERROR(EINVAL);
     s->buffer = av_calloc(s->length, sizeof(*s->buffer));
     if (!s->buffer)
         return AVERROR(ENOMEM);
-- 
2.43.0

