Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to extract ID3v2 text tag if it contains a solidus ('/') #82

Closed
ebassi opened this issue Dec 12, 2022 · 4 comments · Fixed by #83
Closed

Fails to extract ID3v2 text tag if it contains a solidus ('/') #82

ebassi opened this issue Dec 12, 2022 · 4 comments · Fixed by #83
Labels
bug Something isn't working
Milestone

Comments

@ebassi
Copy link

ebassi commented Dec 12, 2022

Reproducer

Create an MP3 file with an ID3v2 tag, set the title tag to Foo / title, and save it as solidus_in_tag.mp3.

   let file = Probe::open("solidus_in_tag.mp3")
       .unwrap()
       .read()
       .unwrap();

   assert_eq!(file.file_type(), FileType::MPEG);

   let id3v2_tag = &file.tags()[0];
   assert_eq!(id3v2_tag.title(), Some("Foo / title"));

Summary

If an ID3v2 text tag contains a solidus (/) then whatever follows the character gets dropped; e.g. a title tag set to Foo / title is returned as Foo .

Expected behavior

The reproducer should pass; the title tag should return Foo / title.

Assets

No response

@ebassi ebassi added the bug Something isn't working label Dec 12, 2022
@ebassi
Copy link
Author

ebassi commented Dec 12, 2022

Created a branch here: https://github.com/ebassi/lofty-rs/tree/solidus-in-tag

I copied one of the MP3 files in the test suite, and added the reproducer as a test case:

failures:

---- mpeg::solidus_in_tag stdout ----
thread 'mpeg::solidus_in_tag' panicked at 'assertion failed: `(left == right)`
  left: `Some("Foo ")`,
 right: `Some("Foo / title")`', tests/files/mpeg.rs:65:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    mpeg::solidus_in_tag

@ebassi
Copy link
Author

ebassi commented Dec 12, 2022

@ebassi ebassi changed the title Fails to extract ID3v22 text tag if it contains a solidus ('/') Fails to extract ID3v2 text tag if it contains a solidus ('/') Dec 12, 2022
Serial-ATA added a commit that referenced this issue Dec 12, 2022
V2 and V3 allow for the separation of multiple values with the solidus (/) character, while in V4 the separator is null (0). This was not accounted for previously, and would break valid V4 strings ("Foo / Bar" would be split into "Foo " and " Bar").

closes #82
Serial-ATA added a commit that referenced this issue Dec 12, 2022
V2 and V3 allow for the separation of multiple values with the solidus (/) character, while in V4 the separator is null (0). This was not accounted for previously, and would break valid V4 strings ("Foo / Bar" would be split into "Foo " and " Bar").

closes #82
@Serial-ATA
Copy link
Owner

Thanks!

@ebassi
Copy link
Author

ebassi commented Dec 12, 2022

Thanks for the super-quick fix, it's much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants