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

# Summary of changes

The first %d was rejected instead of a second one.

Also fix error check of get_frame_filename(). It returns AVERROR code than -1.

<!--
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 8f929070110f860c63146e60c42de9c49b6b8aa2 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Wed, 14 Oct 2026 00:10:13 +0800
Subject: [PATCH 1/2] avfilter/vf_signature: fix error check of
 get_frame_filename()

It returns a negative AVERROR code on failure, not -1.

Signed-off-by: Zhao Zhili <[email protected]>
---
 libavfilter/vf_signature.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index b655b08a87..0bc776a38c 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -726,7 +726,7 @@ static av_cold int init(AVFilterContext *ctx)
     }
 
     /* check filename */
-    if (sic->nb_inputs > 1 && strlen(sic->filename) > 0 && 
get_frame_filename(tmp, sizeof(tmp), sic->filename, 0) == -1) {
+    if (sic->nb_inputs > 1 && strlen(sic->filename) > 0 && 
get_frame_filename(tmp, sizeof(tmp), sic->filename, 0) < 0) {
         av_log(ctx, AV_LOG_ERROR, "The filename must contain %%d or %%0nd, if 
you have more than one input.\n");
         return AVERROR(EINVAL);
     }
-- 
2.52.0


>From fae892ede5e11cb32cceda56845d7c953d071924 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Wed, 14 Oct 2026 00:10:13 +0800
Subject: [PATCH 2/2] avfilter/vf_signature: fix inverted %d check in
 get_frame_filename()

The first %d was rejected instead of a second one.

Signed-off-by: Zhao Zhili <[email protected]>
---
 libavfilter/vf_signature.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index 0bc776a38c..88ef8bb570 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -584,7 +584,7 @@ static int get_frame_filename(char *buf, int buf_size, 
const char *path, int64_t
             case '%':
                 goto addchar;
             case 'd':
-                if (!percentd_found)
+                if (percentd_found)
                     goto fail;
                 percentd_found = 1;
                 if (number < 0)
-- 
2.52.0

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

Reply via email to