This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new b43645b2ef libavformat/id3v2.c: return valid string in decode_str for
empty strings with no bom. Fixes: #YWH-PGM40646-12
b43645b2ef is described below
commit b43645b2ef5da81968291a3f76fbf4ca62af656b
Author: Romain Beauxis <[email protected]>
AuthorDate: Sat Dec 13 12:07:19 2025 -0600
Commit: Timo Rothenpieler <[email protected]>
CommitDate: Mon Dec 22 13:44:42 2025 +0000
libavformat/id3v2.c: return valid string in decode_str for empty strings
with no bom. Fixes: #YWH-PGM40646-12
---
libavformat/id3v2.c | 9 +++++----
tests/fate/id3v2.mak | 6 +++++-
tests/ref/fate/id3v2-invalid-tags | 1 +
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 9d4a9802a9..98969c67a0 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -257,6 +257,9 @@ static int decode_str(AVFormatContext *s, AVIOContext *pb,
int encoding,
return ret;
}
+ if (left == 0)
+ goto end;
+
switch (encoding) {
case ID3v2_ENCODING_ISO8859:
while (left && ch) {
@@ -280,10 +283,7 @@ 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;
+ goto end;
default:
av_log(s, AV_LOG_ERROR, "Incorrect BOM value: 0x%x\n", bom);
ffio_free_dyn_buf(&dynbuf);
@@ -313,6 +313,7 @@ static int decode_str(AVFormatContext *s, AVIOContext *pb,
int encoding,
av_log(s, AV_LOG_WARNING, "Unknown encoding %d\n", encoding);
}
+end:
if (ch)
avio_w8(dynbuf, 0);
diff --git a/tests/fate/id3v2.mak b/tests/fate/id3v2.mak
index 7ad4d877a4..e3eadcbd04 100644
--- a/tests/fate/id3v2.mak
+++ b/tests/fate/id3v2.mak
@@ -1,6 +1,9 @@
FATE_ID3V2_FFPROBE-$(CONFIG_MP3_DEMUXER) += fate-id3v2-priv
fate-id3v2-priv: CMD = probetags $(TARGET_SAMPLES)/id3v2/id3v2_priv.mp3
+FATE_ID3V2_FFMPEG-$(CONFIG_MP3_DEMUXER) += fate-id3v2-invalid-tags
+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"
@@ -13,5 +16,6 @@ FATE_ID3V2_FFMPEG_FFPROBE-$(call REMUX, AIFF, WAV_DEMUXER
FLAC_DEMUXER PCM_S16LE
fate-id3v2-utf16-bom: CMD = transcode wav
$(TARGET_SAMPLES)/audio-reference/yo.raw-short.wav aiff "-map 0:a -map 1:v -af
aresample,channelmap=channel_layout=hexagonal,aresample -c:a pcm_s24be -c:v
copy -write_id3v2 1 -id3v2_version 3 -map_metadata:g:0 1:g -map_metadata:s:v
1:g" "-c copy -t 0.05" "-show_entries
stream=channel_layout:stream_tags:format_tags" "-i
$(TARGET_SAMPLES)/cover_art/cover_art.flac"
FATE_SAMPLES_FFPROBE += $(FATE_ID3V2_FFPROBE-yes)
+FATE_SAMPLES_FFMPEG += $(FATE_ID3V2_FFMPEG-yes)
FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_ID3V2_FFMPEG_FFPROBE-yes)
-fate-id3v2: $(FATE_ID3V2_FFPROBE-yes) $(FATE_ID3V2_FFMPEG_FFPROBE-yes)
+fate-id3v2: $(FATE_ID3V2_FFPROBE-yes) $(FATE_ID3V2_FFMPEG_FFPROBE-yes)
$(FATE_ID3V2_FFMPEG-yes)
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
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]