[FFmpeg-devel] [PATCH 1/2] swscale/utils: Allocate more dithererror

Michael Niedermayer michael at niedermayer.cc
Sat Feb 17 19:09:46 EET 2024


Fixes: out of array read
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libswscale/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index ec822ff5d92..4dc0fbfefbf 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1885,7 +1885,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
     }
 
     for (i = 0; i < 4; i++)
-        if (!FF_ALLOCZ_TYPED_ARRAY(c->dither_error[i], c->dstW + 2))
+        if (!FF_ALLOCZ_TYPED_ARRAY(c->dither_error[i], c->dstW + 3))
             goto nomem;
 
     c->needAlpha = (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) ? 1 : 0;
-- 
2.17.1



More information about the ffmpeg-devel mailing list