mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-07-31 10:52:50 +08:00
Add safeguard in case num_tris diverges
Summary: This PR fixes adds a safeguard preventing num_tris to overflow in `MAX_TRIS`-length arrays. The update rule of `num_tris` is bounded : - max(num_tris(t)) = 2*num_tris(t-1) - num_tris(0) = 12 - t <= 6 So : - max(num_tris) = 2^6*12 - max(num_tris) = 768 Reviewed By: bottler Differential Revision: D66162573 fbshipit-source-id: e269a79c75c6cc33306986b1f1256cffbe96c730
This commit is contained in:
parent
81d82980bc
commit
91c9f34137
@ -728,7 +728,7 @@ __device__ inline int BoxIntersections(
|
||||
}
|
||||
}
|
||||
// Update the face_verts_out tris
|
||||
num_tris = offset;
|
||||
num_tris = min(MAX_TRIS, offset);
|
||||
for (int j = 0; j < num_tris; ++j) {
|
||||
face_verts_out[j] = tri_verts_updated[j];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user