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

Integer overflow in snd_mem.c #106

Closed
miried opened this issue Jan 10, 2015 · 1 comment
Closed

Integer overflow in snd_mem.c #106

miried opened this issue Jan 10, 2015 · 1 comment

Comments

@miried
Copy link

miried commented Jan 10, 2015

ResampleSfx() and ResampleSfxRaw() in snd_mem.c resample the input audio file to the audio driver's sampling rate. The multiplication by 256=2^8 and subsequent bitshift by 8 bits to the right of the buffer offset allow for an upscaling of input frequencies as low as 1/256 of the target sampling rate, but they reduce the resulting maximum number of samples by 8 bits. This allows only for 95 seconds of playtime at 44.1 khz or 190 seconds at 22 khz. After that, samplefrac overflows.

One "fix" would be to change 2^8 and 8 to smaller values, maybe 2^3=8 and 3, and add a warning message if the sampling rate is too small.

@zturtleman
Copy link
Member

Fixed by #230, closing.

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