Repository navigation
ID3v1: Don't mistake the end of an APE tag for an ID3v1 tag - #763
Merged
Merged
Conversation
`find_id3v1` took any "TAG" 128 bytes from the end of the stream as an ID3v1 tag. When the stream ends with an APE tag, those bytes can belong to it, such as the "TAG" in the "APETAGEX" preamble of a 131 byte tag's header. The APE tag was then not found, and any write replaced its last 128 bytes with the bogus ID3v1 tag. If a stream ends with an APE tag footer, nothing follows the APE tag, so the stream has no ID3v1 tag. closes Serial-ATA#762
Serial-ATA
force-pushed
the
id3v1-ape-footer
branch
from
November 23, 2026 00:51
caca781 to
543a6ce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #762
find_id3v1now checks the last 32 bytes of the stream before it accepts aTAGmarker. If they start withAPETAGEX, the stream ends with an APE tag footer, nothing can follow it, and there is no ID3v1 tag.Every reader and writer that looks for an ID3v1 tag goes through
find_id3v1, so this one check covers reading, saving andTagType::Id3v1.remove_from.The test is the reproducer from the issue: an MP3 whose only tag is a 131 byte APE tag. It reads the file, saves an ID3v2 tag into it, and removes the ID3v1 tag it does not have, checking the APE tag after each step. It fails on
mainwithout the fix. The changelog entry is under Unreleased, Fixed.