From 2658cd930f952b6bd32ee48a7430a6ba42a45643 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael@niedermayer.cc>
Date: Thu, 27 Jun 2024 13:46:29 +0800
Subject: [PATCH] fix CVE-2023-51793

---
 libavfilter/vf_weave.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_weave.c b/libavfilter/vf_weave.c
index 663d79f..fafaaa0 100644
--- a/libavfilter/vf_weave.c
+++ b/libavfilter/vf_weave.c
@@ -30,6 +30,7 @@ typedef struct WeaveContext {
     int double_weave;
     int nb_planes;
     int planeheight[4];
+    int outheight[4];
     int linesize[4];
 
     AVFrame *prev;
@@ -71,7 +72,10 @@ static int config_props_output(AVFilterLink *outlink)
 
     s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-
+    
+    s->outheight[1] = s->outheight[2] = AV_CEIL_RSHIFT(2*inlink->h, desc->log2_chroma_h);
+    s->outheight[0] = s->outheight[3] = 2*inlink->h;
+    
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
 
     return 0;
-- 
2.43.0

