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

Panic reading mp3 tag #492

Open
milesegan opened this issue Dec 1, 2024 · 0 comments
Open

Panic reading mp3 tag #492

milesegan opened this issue Dec 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@milesegan
Copy link

Reproducer

I tried this code:

use std::path::Path;

use lofty::config::{ParseOptions, ParsingMode};
use lofty::file::{AudioFile, TaggedFileExt};
use lofty::probe::Probe;
use lofty::tag::Accessor;

fn main() {
    // the error seems to occur with strict or relaxed parsing mode
    let parsing_options = ParseOptions::new().parsing_mode(ParsingMode::Relaxed);
    let path = Path::new("sample.mp3");
    let file = Probe::open(&path)
        .expect("can't probe")
        .options(parsing_options)
        .read()
        .expect("can't read");
    let tag = file.primary_tag().expect("no tag");
    let properties = file.properties();
    println!("{:?}", tag.artist());
    println!("{:?}", tag.year());
}

Summary

This results in this panic:

thread 'main' panicked at src/main.rs:16:10:
can't read: TextDecode("UTF-16 string has an odd length")

Expected behavior

ffprobe and id3info both seem to be able to read this sample file ok. Are they just falling back to some kind of best-effort conversion for badly encoded UTF-16 strings perhaps?

Assets

sample.mp3.zip

@milesegan milesegan added the bug Something isn't working label Dec 1, 2024
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

No branches or pull requests

1 participant