-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
Risky stackallocs #303
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just found and fixed an unguarded stackalloc in
CompoundPairOverlapHandler
, so quickly scanned for other sketchy instances.CompoundBuilder.ComputeInertia
:https://github.com/bepu/bepuphysics2/blob/master/BepuPhysics/Collidables/CompoundBuilder.cs#L380
https://github.com/bepu/bepuphysics2/blob/master/BepuPhysics/Collidables/CompoundBuilder.cs#L402
Helper function; no strict need to allocate a temporary array in the first place. Could fail for extremely large compounds.
Lower risk:
Tree.RayCast
:bepuphysics2/BepuPhysics/Trees/Tree_RayCast.cs
Line 109 in 563773c
With the tree revamp, hitting this profoundly unlikely, but we do still expose the old sometimes-pathological insertion in the API. It's not impossible for this to fail. This was always a hack.
https://github.com/bepu/bepuphysics2/blob/master/BepuPhysics/CollisionDetection/CollisionTasks/ConvexHullPairTester.cs#L90
In order for this to fail, the
ConvexHull
would need to be nigh adversarially pathological, but it's not impossible. Could be worth just wrapping it in a buffer just to have some catch.On the fence:
TaskStack
usages:https://github.com/bepu/bepuphysics2/blob/master/BepuUtilities/TaskScheduling/TaskStack.cs
The
TaskStack
is a type I don't expect external users to ever even know about, and the nature of the failure is direct: if a specific function call is provided too many tasks at once, it fails immediately. I'm treating it as a user error condition given that I'm realistically the only user.The text was updated successfully, but these errors were encountered: