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 <[email protected]> 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 -- [email protected] To unsubscribe send an email to [email protected]
