You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mutagen appears to not check whether a file has ID3 v1.0 or 1.1 tags when reading the comment field. This is a problem because in IDv1.0, the comment field can be up to 30 bytes in length, but in 1.1, the comment field can only be 28 bytes, with byte 29 required to be 0, and byte 30 used to represent the track number.
It seems as though Mutagen treats all ID3v1 tags as following the v1.1 specification. Thus, when a file has an ID3 v1.0 tag with a comment that is 30 bytes long, the 30th byte of the comment will be cast to an integer and used as the TRCK ID3 field.
I am using Mp3tag to demonstrate this issue. Mp3tag is clever and decides whether to write a v1.0 or v1.1 ID3v1 tag based upon whether a track number is defined or not. If no track number is defined, Mp3tag will save the tag as v1.0 with 30 bytes for the comment field to store as much of the full comment as possible. However, if a track number is defined, Mp3tag will instead save it as a v1.1 tag with only 28 bytes in the comment field.
The comment I am trying to write in the comment field is "This comment exceeds the length allowed by ID3v1".
If I save this file without a track number, Mp3Tag writes an ID3v1.0 tag as follows:
Mutagen appears to not check whether a file has ID3 v1.0 or 1.1 tags when reading the comment field. This is a problem because in IDv1.0, the comment field can be up to 30 bytes in length, but in 1.1, the comment field can only be 28 bytes, with byte 29 required to be 0, and byte 30 used to represent the track number.
It seems as though Mutagen treats all ID3v1 tags as following the v1.1 specification. Thus, when a file has an ID3 v1.0 tag with a comment that is 30 bytes long, the 30th byte of the comment will be cast to an integer and used as the TRCK ID3 field.
I am using Mp3tag to demonstrate this issue. Mp3tag is clever and decides whether to write a v1.0 or v1.1 ID3v1 tag based upon whether a track number is defined or not. If no track number is defined, Mp3tag will save the tag as v1.0 with 30 bytes for the comment field to store as much of the full comment as possible. However, if a track number is defined, Mp3tag will instead save it as a v1.1 tag with only 28 bytes in the comment field.
The comment I am trying to write in the comment field is "This comment exceeds the length allowed by ID3v1".
If I save this file without a track number, Mp3Tag writes an ID3v1.0 tag as follows:
When this file is loaded by Mutagen, it reports the following tag fields, which demonstrates the bug:
TRCK is inappropriately defined and assigned the value 116, which corresponds to the ASCII code for 't' (the 30th character of the ID3v1 comment).
However, if I save this file with the track number 1, Mp3Tag instead writes an ID3v1.1 tag as follows:
This file is handled correctly by Mutagen with the following fields:
The text was updated successfully, but these errors were encountered: