-
-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Reproducer
I tried this code:
let path = "foo.mp3";
let mut file = lofty::read_from_path(path)?;
let mut id3v2 = Id3v2Tag::from(file.primary_tag().unwrap().clone());
let sylt_frame = SynchronizedTextFrame::new(
lofty::TextEncoding::UTF8,
[b'X', b'X', b'X'],
lofty::id3::v2::TimestampFormat::MS,
lofty::id3::v2::SyncTextContentType::Lyrics,
None,
vec![(1, "Hello".into()), (2, "".into())],
);
let sylt_frame_byte =
sylt_frame.as_bytes().expect("should not happen, error constraints are clear");
let sylt_frame_id = lofty::id3::v2::FrameId::new("SYLT").unwrap();
id3v2.insert(lofty::id3::v2::Frame::Binary(lofty::id3::v2::BinaryFrame::new(
sylt_frame_id,
sylt_frame_byte,
)));
*file.primary_tag_mut().unwrap() = id3v2.into();
file.save_to_path(path, Default::default())?;
let file = lofty::read_from_path(path)?;
let id3v2 = Id3v2Tag::from(file.primary_tag().unwrap().clone());
let Some(lofty::id3::v2::Frame::Binary(frame)) =
id3v2.get(&lofty::id3::v2::FrameId::new("SYLT").unwrap())
else {
unreachable!()
};
SynchronizedTextFrame::parse(&frame.data, frame.flags())?;Summary
Should parse correctly -- doesn't parse, returns a Error: ID3v2: Encountered invalid data in SYLT frame -- reason is that the terminated byte does not get counted for empty strings.
See #564 for the fix
Expected behavior
Code works
Assets
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working