Skip to content

Avoid possible divide by zero in scene. #109105

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alesliehughes
Copy link
Contributor

Both of these functions are used in a divide, so returning 0 will just cause a crash.

@alesliehughes alesliehughes requested a review from a team as a code owner July 30, 2025 03:15
@fire fire changed the title scene: Avoid possible divide by zero. Avoid possible divide by zero in scene. Jul 30, 2025
@lawnjelly
Copy link
Member

lawnjelly commented Jul 30, 2025

I would fix these at the call sites, code not checking for divide by zero is unsafe code.

We have also previously talked about enforcing this by having process etc return 0 during startup / CI checks, which sounds a better approach.

@AThousandShips AThousandShips added this to the 4.6 milestone Jul 30, 2025
@alesliehughes alesliehughes requested review from a team as code owners August 5, 2025 01:23
@KoBeWi
Copy link
Member

KoBeWi commented Aug 7, 2025

Isn't result of float division by zero an infinity instead of crash?

@alesliehughes
Copy link
Contributor Author

Isn't result of float division by zero an infinity instead of crash?

You are correct. Though once it has this value, any calculation will be infinity as well.

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

Successfully merging this pull request may close these issues.

5 participants