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

Avoid casting -inf to an integer type in the sound code #39349

Merged
merged 1 commit into from
Apr 8, 2020

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: None

Purpose of change

The sound handling code could end up casting log(0) to an integer type when there were no sounds around. The undefined behaviour sanitizer complains about that.

Describe the solution

Avoid that by an early exit.

Describe alternatives you've considered

Clamping the values as doubles before casting would also work.

Testing

Reran with UBSan after change. No crash. Didn't actually test that sound is still working.

The sound handling code could end up casting log(0) to an integer type
when there were no sounds around.  Avoid that by an early exit.
@kevingranade kevingranade merged commit be7ab20 into CleverRaven:master Apr 8, 2020
@jbytheway jbytheway deleted the avoid_infinity branch April 8, 2020 14:37
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

Successfully merging this pull request may close these issues.

2 participants