* [FFmpeg-devel] [PATCH] libavformat/id3v2.c: return valid string in decode_str for empty strings (PR #21187)
@ 2025-12-13 19:23 toots via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: toots via ffmpeg-devel @ 2025-12-13 19:23 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: toots
PR #21187 opened by toots
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21187
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21187.patch
>From 420afb9ef7009231c33663cc9085143fc3d3f6a1 Mon Sep 17 00:00:00 2001
From: Romain Beauxis <romain.beauxis@gmail.com>
Date: Sat, 13 Dec 2025 12:07:19 -0600
Subject: [PATCH] libavformat/id3v2.c: return valid string in decode_str for
empty strings with no bom. Fixes: #YWH-PGM40646-12
---
libavformat/id3v2.c | 6 ++----
tests/fate/id3v2.mak | 4 ++++
tests/ref/fate/id3v2-invalid-tags | 1 +
3 files changed, 7 insertions(+), 4 deletions(-)
create mode 100644 tests/ref/fate/id3v2-invalid-tags
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 9d4a9802a9..5977587b59 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -280,10 +280,8 @@ static int decode_str(AVFormatContext *s, AVIOContext *pb, int encoding,
case 0xfeff:
break;
case 0: // empty string without bom
- ffio_free_dyn_buf(&dynbuf);
- *dst = NULL;
- *maxread = left;
- return 0;
+ *maxread = 0;
+ break;
default:
av_log(s, AV_LOG_ERROR, "Incorrect BOM value: 0x%x\n", bom);
ffio_free_dyn_buf(&dynbuf);
diff --git a/tests/fate/id3v2.mak b/tests/fate/id3v2.mak
index 7ad4d877a4..ce47f19e8d 100644
--- a/tests/fate/id3v2.mak
+++ b/tests/fate/id3v2.mak
@@ -1,6 +1,10 @@
FATE_ID3V2_FFPROBE-$(CONFIG_MP3_DEMUXER) += fate-id3v2-priv
fate-id3v2-priv: CMD = probetags $(TARGET_SAMPLES)/id3v2/id3v2_priv.mp3
+FATE_ID3V2_FFPROBE-$(CONFIG_MP3_DEMUXER) += fate-id3v2-invalid-tags
+fate-id3v2-invalid-tags: $(FFMPEG)
+fate-id3v2-invalid-tags: CMD = $(FFMPEG) -nostdin -hide_banner -loglevel fatal -i $(TARGET_SAMPLES)/id3v2/invalid-tags.mp3 -f null - 2>&1 || true
+
FATE_ID3V2_FFMPEG_FFPROBE-$(call REMUX, MP3) += fate-id3v2-priv-remux
fate-id3v2-priv-remux: CMD = transcode mp3 $(TARGET_SAMPLES)/id3v2/id3v2_priv.mp3 mp3 "-c copy" "-c copy -t 0.1" "-show_entries format_tags"
diff --git a/tests/ref/fate/id3v2-invalid-tags b/tests/ref/fate/id3v2-invalid-tags
new file mode 100644
index 0000000000..a79ba0cf87
--- /dev/null
+++ b/tests/ref/fate/id3v2-invalid-tags
@@ -0,0 +1 @@
+Error opening input files: Invalid data found when processing input
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-13 19:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-13 19:23 [FFmpeg-devel] [PATCH] libavformat/id3v2.c: return valid string in decode_str for empty strings (PR #21187) toots via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git