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

AAC: thread 'main' panicked at 'called Option::unwrap() on a None value' #64

Closed
kamiyaa opened this issue Oct 31, 2021 · 3 comments
Closed

Comments

@kamiyaa
Copy link

kamiyaa commented Oct 31, 2021

The culprit seems to be:
https://github.com/pdeljanov/Symphonia/blob/master/symphonia-codec-aac/src/aac.rs#L1623

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/kamiyaa/.cargo/registry/src/github.com-.../symphonia-codec-aac-0.3.0/src/aac.rs:1639:48

Expected: returns Err
Actual: panics

I can probably write a fix for this, but not really sure what error to throw

@pdeljanov
Copy link
Owner

I think #58 may resolve this panic (it won't make your file playable though).

I haven't had a chance to go through the PR yet though. Can you give your file a try via. symphonia-play and see if it still crashes? If it fixes it, then I will try to get it merged ASAP.

Also, if you're okay with sharing your file, I wouldn't mind seeing if I can make it playable. The issue in #58 was only found through fuzzing, so you've found a real life example of it.

@kamiyaa
Copy link
Author

kamiyaa commented Oct 31, 2021

Yea, that fixes it;

~$ ./target/debug/symphonia-play "BK/003.png"
+ BK/003.png
|
| // Tracks //
|     [01] Codec:           Advanced Audio Coding (aac)
|          Sample Rate:     0
:

 ERROR symphonia_codec_aac::aac > check failed at symphonia-codec-aac/src/aac.rs:1620
 ERROR symphonia_play           > error: malformed stream: aac: invalid data

It's actually a png file 👀 💦 .
I was mostly using symphonia as a way to figure out if its an audio file.
ie. if symphonia reads it, I continue processing it, otherwise its not an audio file.

@pdeljanov
Copy link
Owner

That's a unique use-case I didn't think of 😅. It should be fine most of the time, but there may be a few false positives. It may make sense to filter by file extension first before trying to get Symphonia to read it. Constructing decoders can also be expensive for some codecs, so you may see a performance uplift if you're doing this with many files.

I also merged #58, so you can point your Cargo.toml to commit 491d116 if you want the fix immediately.

Please let me know if you see anymore panics as well.

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

2 participants