[FFmpeg-devel] [PATCH 3/3] libswscale/utils: Fix bayer to yuvj

Michael Niedermayer michael at niedermayer.cc
Tue Feb 20 04:49:22 EET 2024


Fixes: out of array access.

Earlier code assumes that a unscaled bayer to yuvj420 converter exists
but the later code then skips yuvj420

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libswscale/utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index d27128e42f..ab8a68e241 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1728,7 +1728,8 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
     /* unscaled special cases */
     if (unscaled && !usesHFilter && !usesVFilter &&
         (c->srcRange == c->dstRange || isAnyRGB(dstFormat) ||
-         isFloat(srcFormat) || isFloat(dstFormat))){
+         isFloat(srcFormat) || isFloat(dstFormat) || isBayer(srcFormat))){
+
         ff_get_unscaled_swscale(c);
 
         if (c->convert_unscaled) {
-- 
2.17.1



More information about the ffmpeg-devel mailing list