PR #23718 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23718
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23718.patch


From 3a9af3a8c414e5b4700a6f35ddfebaf0a6bce3a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Mon, 6 Jul 2026 12:50:42 +0200
Subject: [PATCH 1/3] tools/target_dec_fuzzer: use av_fallthrough to avoid
 warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <[email protected]>
---
 tools/target_dec_fuzzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 284b76d727..5e60949663 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -461,7 +461,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
                 }
                 if (ctx->codec_id != AV_CODEC_ID_DTS)
                     break;
-            // fall-through
+            av_fallthrough;
             case AV_CODEC_ID_DOLBY_E:
                 av_dict_set_int(&opts, "channel_order", 
!!(request_channel_layout & INT64_MIN), 0);
                 break;
-- 
2.52.0


From 0bfbcc67cab597505c1c67f7a1888f7b0ae3b4f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Mon, 6 Jul 2026 12:50:59 +0200
Subject: [PATCH 2/3] tools/target_enc_fuzzer: mark flags64 as unused
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Still read, to not change byte stream offsets. Technically we could skip
those bytes, but this way it's clear for te future that we can use those
flags for anything needed.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 tools/target_enc_fuzzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/target_enc_fuzzer.c b/tools/target_enc_fuzzer.c
index 059d783071..543770eaae 100644
--- a/tools/target_enc_fuzzer.c
+++ b/tools/target_enc_fuzzer.c
@@ -112,7 +112,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
     if (size > 1024) {
         GetByteContext gbc;
         int flags;
-        int64_t flags64;
+        av_unused int64_t flags64;
 
         size -= 1024;
         bytestream2_init(&gbc, data + size, 1024);
-- 
2.52.0


From a8bf61110fc7d89e2b2f8fcf6a12079102e14f31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Mon, 6 Jul 2026 12:54:16 +0200
Subject: [PATCH 3/3] tools/target_enc_fuzzer: don't access removed
 AVCodec::pix_fmts
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <[email protected]>
---
 tools/target_enc_fuzzer.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/target_enc_fuzzer.c b/tools/target_enc_fuzzer.c
index 543770eaae..2e1dfe7dde 100644
--- a/tools/target_enc_fuzzer.c
+++ b/tools/target_enc_fuzzer.c
@@ -135,12 +135,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 
         flags64 = bytestream2_get_le64(&gbc);
 
-        if (c->p.pix_fmts) {
-            int npixfmts = 0;
-            while (c->p.pix_fmts[npixfmts++] != AV_PIX_FMT_NONE)
-                ;
-            ctx->pix_fmt = c->p.pix_fmts[bytestream2_get_byte(&gbc) % 
npixfmts];
-        }
+        const enum AVPixelFormat *pix_fmts;
+        int pix_fmts_num;
+        int res = avcodec_get_supported_config(ctx, NULL, 
AV_CODEC_CONFIG_PIX_FORMAT,
+                                               0, (const void **) &pix_fmts,
+                                               &pix_fmts_num);
+        if (res >= 0 && pix_fmts_num > 0)
+            ctx->pix_fmt = pix_fmts[bytestream2_get_byte(&gbc) % pix_fmts_num];
 
         switch (c->p.id) {
         case AV_CODEC_ID_FFV1:{
-- 
2.52.0

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

Reply via email to