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

Attempt to subtract with overflow when reading aac file in musepack/read #440

Closed
qarmin opened this issue Aug 4, 2024 · 0 comments · Fixed by #444
Closed

Attempt to subtract with overflow when reading aac file in musepack/read #440

qarmin opened this issue Aug 4, 2024 · 0 comments · Fixed by #444
Labels
bug Something isn't working
Milestone

Comments

@qarmin
Copy link

qarmin commented Aug 4, 2024

Reproducer

Backtrace is a little different than in - #439

const ALL_FILE_TYPES: &[FileType] = &[FileType::Aac, FileType::Aiff, FileType::Ape, FileType::Flac, FileType::Mpeg, FileType::Mp4, FileType::Mpc, FileType::Opus, FileType::Vorbis, FileType::Speex, FileType::Wav, FileType::WavPack];

fn check_file(path: &str) {
    let content = match fs::read(&path) {
        Ok(content) => content,
        Err(e) => {
            println!("{e} - {path}");
            return;
        }
    };

    for i in ALL_FILE_TYPES {
        let s = std::io::Cursor::new(&content);
        let tagged_file = match Probe::with_file_type(s, *i).read() {
            Ok(t) => t,
            Err(_e) => {
                continue;
            }
        };
        tagged_file.properties();
        tagged_file.tags();
        tagged_file.primary_tag();
    }
}

Summary

thread 'main' panicked at /home/runner/.cargo/git/checkouts/lofty-rs-f5e48f8219b271cf/1505ddf/lofty/src/musepack/read.rs:50:3:
attempt to subtract with overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fd8d6fbe505ecf913f5e2ca590c69a7da2789879/library/std/src/panicking.rs:662:5
   1: core::panicking::panic_fmt
             at /rustc/fd8d6fbe505ecf913f5e2ca590c69a7da2789879/library/core/src/panicking.rs:74:14
   2: core::panicking::panic_const::panic_const_sub_overflow
             at /rustc/fd8d6fbe505ecf913f5e2ca590c69a7da2789879/library/core/src/panicking.rs:181:21
   3: lofty::musepack::read::read_from
             at /home/runner/.cargo/git/checkouts/lofty-rs-f5e48f8219b271cf/1505ddf/lofty/src/musepack/read.rs:50:3
   4: <lofty::musepack::MpcFile as lofty::file::audio_file::AudioFile>::read_from
             at /home/runner/.cargo/git/checkouts/lofty-rs-f5e48f8219b271cf/1505ddf/lofty/src/musepack/mod.rs:57:10
   5: lofty::probe::Probe<R>::read
             at /home/runner/.cargo/git/checkouts/lofty-rs-f5e48f8219b271cf/1505ddf/lofty/src/probe.rs:477:22
   6: lofty::check_file
             at ./src/crates/lofty/src/main.rs:42:33
   7: lofty::main
             at ./src/crates/lofty/src/main.rs:26:9
   8: core::ops::function::FnOnce::call_once
             at /rustc/fd8d6fbe505ecf913f5e2ca590c69a7da2789879/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

##### Automatic Fuzzer note, output status "None", output signal "Some(6)"

Expected behavior

No response

Assets

output.aac.zip

@qarmin qarmin added the bug Something isn't working label Aug 4, 2024
@Serial-ATA Serial-ATA added this to the 0.22.0 milestone Aug 12, 2024
@Serial-ATA Serial-ATA modified the milestones: 0.22.0, 0.21.1 Aug 24, 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

Successfully merging a pull request may close this issue.

2 participants