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 when checking aiff file #299

Open
qarmin opened this issue Jul 9, 2024 · 0 comments
Open

Panic when checking aiff file #299

qarmin opened this issue Jul 9, 2024 · 0 comments

Comments

@qarmin
Copy link

qarmin commented Jul 9, 2024

Code

pub fn parse_audio_file(file_handler: File) -> Result<(), Error> {
    let mss = MediaSourceStream::new(Box::new(file_handler), Default::default());

    let probed = match symphonia::default::get_probe().format(
        &Default::default(),
        mss,
        &Default::default(),
        &Default::default(),
    ) {
        Ok(t) => t,
        Err(_) => {
            return Err(Error::Unsupported(
                "probe info not available/file not recognized",
            ))
        }
    };

    let mut format = probed.format;

    let track = match format
        .tracks()
        .iter()
        .find(|t| t.codec_params.codec != CODEC_TYPE_NULL)
    {
        Some(k) => k,
        None => return Err(Error::Unsupported("not supported audio track")),
    };

    let mut decoder =
        match symphonia::default::get_codecs().make(&track.codec_params, &Default::default()) {
            Ok(k) => k,
            Err(_) => return Err(Error::Unsupported("not supported codec")),
        };

    loop {
        let packet = match format.next_packet() {
            Ok(packet) => packet,
            Err(Error::ResetRequired) => {
                return Err(Error::ResetRequired);
            }
            Err(err) => {
                if let IoError(ref er) = err {
                    // Catch eof, not sure how to do it properly
                    if er.kind() == io::ErrorKind::UnexpectedEof {
                        return Ok(());
                    }
                }
                return Err(err);
            }
        };

        decoder.decode(&packet)?;
    }
}
thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/symphonia-core-0.5.4/src/units.rs:150:13:
TimeBase cannot have 0 numerator or denominator
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:693:12
   1: symphonia_core::units::TimeBase::new
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/symphonia-core-0.5.4/src/units.rs:150:13
   2: symphonia_format_riff::common::append_format_params
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/symphonia-format-riff-0.5.4/src/common.rs:366:63
   3: <symphonia_format_riff::aiff::AiffReader as symphonia_core::formats::FormatReader>::try_new
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/symphonia-format-riff-0.5.4/src/aiff/mod.rs:113:21
   4: <symphonia_format_riff::aiff::AiffReader as symphonia_core::probe::QueryDescriptor>::query::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/symphonia-core-0.5.4/src/probe.rs:360:65
   5: core::ops::function::FnOnce::call_once
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
   6: symphonia_core::probe::Probe::format
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/symphonia-core-0.5.4/src/probe.rs:326:34
   7: symphonia::parse_audio_file
             at ./src/crates/symphonia/src/main.rs:43:24
   8: symphonia::check_file
             at ./src/crates/symphonia/src/main.rs:37:13
   9: symphonia::main
             at ./src/crates/symphonia/src/main.rs:24:9
  10: core::ops::function::FnOnce::call_once
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
timeout: the monitored command dumped core

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

compressed.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant