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

fixes 1e7d7c4

Without this fix, all non-ascii characters, such as CJK, will fail the check.

```
[aist#0:4/ttf @ 000001e74c85eb00] Filename 方正粗宋_GBK.ttf is unsafe
```

Signed-off-by: nyanmisaka <[email protected]>


From 63cda2a8ae1909f4bb778dd0651a6da724e56eda Mon Sep 17 00:00:00 2001
From: nyanmisaka <[email protected]>
Date: Fri, 5 Jun 2026 03:31:02 +0800
Subject: [PATCH] fftools/ffmpeg_demux: Fix extracting mkv acttachments with
 non-ascii filenames
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

fixes 1e7d7c4

Without this fix, all non-ascii characters, such as CJK, will fail the check.

```
[aist#0:4/ttf @ 000001e74c85eb00] Filename 方正粗宋_GBK.ttf is unsafe
```

Signed-off-by: nyanmisaka <[email protected]>
---
 fftools/ffmpeg_demux.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 04ee2cc2ed..050908585b 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1926,6 +1926,10 @@ static int safe_filename(const char *f, int allow_subdir)
         return 0;
 
     for (; *f; f++) {
+        /* Non-ASCII bytes cannot be '/' or '.' */
+        if ((unsigned char)*f > 127)
+            continue;
+
         /* A-Za-z0-9_- */
         if (!((unsigned)((*f | 32) - 'a') < 26 ||
               (unsigned)(*f - '0') < 10 || *f == '_' || *f == '-')) {
-- 
2.52.0

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

Reply via email to