Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: toots via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: toots <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] libavformat/id3v2.c: return valid string in decode_str for empty strings (PR #21187)
Date: Sat, 13 Dec 2025 19:23:41 -0000
Message-ID: <176565382197.39.12783497316509127341@2cb04c0e5124> (raw)

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

                 reply	other threads:[~2025-12-13 19:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176565382197.39.12783497316509127341@2cb04c0e5124 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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