PR #23732 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23732
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23732.patch

Fixes: assertion failure
Fixes: 
523522308/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_DEC_fuzzer-4771843818192896
Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <[email protected]>



>From 0d60d64d6b3690162a638bdf8556c209706ff9b1 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Sun, 5 Jul 2026 01:43:49 +0200
Subject: [PATCH] avcodec/mjpegdec: reject flipping of bayer images

Fixes: assertion failure
Fixes: 
523522308/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_DEC_fuzzer-4771843818192896
Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/mjpegdec.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 0853d76372..23242abbb9 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2167,9 +2167,10 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
     } else if (!strcmp(cbuf, "CS=ITU601"))
         s->cs_itu601 = 1;
     else if ((!strncmp(cbuf, "Intel(R) JPEG Library, version 1", 32) && 
s->avctx->codec_tag) ||
-             (!strncmp(cbuf, "Metasoft MJPEG Codec", 20)))
-        s->flipped = 1;
-    else if (!strcmp(cbuf, "MULTISCOPE II")) {
+             (!strncmp(cbuf, "Metasoft MJPEG Codec", 20))) {
+        if (!s->bayer)
+            s->flipped = 1;
+    } else if (!strcmp(cbuf, "MULTISCOPE II")) {
         s->avctx->sample_aspect_ratio = (AVRational) { 1, 2 };
         s->multiscope = 2;
     }
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to