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

[BR] Fix integer overflow in physx::writeCompressedContact causing sim corruption #357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Zeblote
Copy link
Collaborator

@Zeblote Zeblote commented Jan 29, 2025

If a contact buffer has exactly 256 contacts in it, the endIndex on its last StrideBatch will overflow from 256 to 0, causing it to fail to copy the last batch of contacts but still setting the output count to include it, sending uninitialized garbage data into the solver, which kills the simulation very quickly.

Example of 256 input contacts to the function
image

Corresponding grouped output contacts, note the last group is garbage
image

The root cause is this u8 overflowing back to 0
image

We can fix it easily by using PxU16 instead so it can hold the proper count

cc @PierreTerdiman

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.

1 participant