PR #23719 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23719
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23719.patch

FFMPEG_CONFIGURATION and FFMPEG_VERSION were concatenated into av_log
format strings, so any % in them was interpreted as a conversion
specifier and consumed unrelated varargs, causing undefined behavior
ranging from garbled output to a segfault on `ffmpeg -version`. Pass
both as %s arguments instead.

Fixes issue #23662.

The FFMPEG_CONFIGURATION fix is based on patch by FinnRG in issue
description.

Signed-off-by: Zhao Zhili <[email protected]>

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 8c4b38cb2d77dfb53d1135865b69f93bf66b7d10 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Mon, 6 Jul 2026 20:17:13 +0800
Subject: [PATCH] fftools/opt_common: fix format string bug in show_banner

FFMPEG_CONFIGURATION and FFMPEG_VERSION were concatenated into av_log
format strings, so any % in them was interpreted as a conversion
specifier and consumed unrelated varargs, causing undefined behavior
ranging from garbled output to a segfault on `ffmpeg -version`. Pass
both as %s arguments instead.

Fixes issue #23662.

The FFMPEG_CONFIGURATION fix is based on patch by FinnRG in issue
description.

Signed-off-by: Zhao Zhili <[email protected]>
---
 fftools/opt_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 82b3cf2464..572cc563e3 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -201,14 +201,14 @@ static void print_program_info(int flags, int level)
 {
     const char *indent = flags & INDENT? "  " : "";
 
-    av_log(NULL, level, "%s version " FFMPEG_VERSION, program_name);
+    av_log(NULL, level, "%s version %s", program_name, FFMPEG_VERSION);
     if (flags & SHOW_COPYRIGHT)
         av_log(NULL, level, " Copyright (c) %d-%d the FFmpeg developers",
                program_birth_year, CONFIG_THIS_YEAR);
     av_log(NULL, level, "\n");
     av_log(NULL, level, "%sbuilt with %s\n", indent, CC_IDENT);
 
-    av_log(NULL, level, "%sconfiguration: " FFMPEG_CONFIGURATION "\n", indent);
+    av_log(NULL, level, "%sconfiguration: %s\n", indent, FFMPEG_CONFIGURATION);
 }
 
 static void print_buildconf(int flags, int level)
-- 
2.52.0

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

Reply via email to