-
Notifications
You must be signed in to change notification settings - Fork 105
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
Program panics with integer overflow when making audio fingerprints #159
Comments
Hello, There was a recent change in this part of the code (change d40f184 performed after issue #143), handling specifically the case of adding a negative peak_variation variable. In this change, I introduced an intentional rollover integer overflow behavior (as I would do in C to add up a large unsigned short and a small signed short). Indeed, this was a stupid thing to do because the runtime integer overflow arithmetic checks are disabled only in the release mode in Rust. In debug mode (as you are compiling with: Hence thank you for noticing, I introduced a fix in commit 766a999 However beware, SongRec compiled in debug mode is very slow to recognize songs. Regards, |
Thanks for the swift fix. I thought about just moving to i32s myself but I didn't know if it would cause any issues, since I'm thoroughly unqualified to judge the output. And thanks for the warning about debug mode. I'm just using it to explore use cases as a library so I'm unconcerned with speed right now, but I'll keep that in mind. |
The latest master branch panics with integer overflow during the
do_peak_recognition
step of fingerprinting.Using ubuntu on WSL2. ffmpeg is installed.
System Info
$ uname -a Linux CompName 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
The line it crashes at is
Some of the variable values are:
Running these values through the castings and additions, we end up with
which of course is greater than a u16.
I'm working with the mp3 file from https://www.newgrounds.com/audio/download/1975, but it happens with every song I run through.
The text was updated successfully, but these errors were encountered: