Skip to content

Timestamp parse error makes entire id3 tag unreadable #462

Closed
@milesegan

Description

@milesegan

Reproducer

use std::path::Path;

use lofty::config::{ParseOptions, ParsingMode};
use lofty::file::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");
    println!("{:?}", tag.artist());
}

Summary

Trying to parse the attached file gives this error:

can't read: BadTimestamp("Expected a separator")

Expected behavior

If the timestamp is invalid could it be skipped in relaxed parsing mode?

ffprobe output:

Input #0, mp3, from '/Users/miles/tmp/sample.mp3':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6mp41
    creation_time   : 2015-07-08 16:53:04
    encoder         : Lavf54.20.4
    title           : Freedom
    artist          : Pharrell Williams
    album           : Freedom - Single 
    title-sort      : Freedom
    album-sort      : Freedom - Single 
    artist-sort     : Pharrell Williams
  Duration: 00:02:44.49, start: 0.000000, bitrate: 130 kb/s
  Stream #0:0: Audio: mp3 (mp3float), 44100 Hz, stereo, fltp, 128 kb/s
  Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 600x600 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn (attached pic)
      Metadata:
        comment         : Other

Assets

sample.mp3.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions