Skip to content

[BUG] wp.Mesh crashes on out-of-range triangle indices #2288

Open

Description

@christophercrouzet

Bug Description

wp.Mesh() reads points[indices[i]] without checking that each index is in [0, len(points)). An out-of-range or negative index crashes the process on CPU:

import warp as wp

points = wp.array([(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)], dtype=wp.vec3, device="cpu")
indices = wp.array([0, 1, 100_000_000], dtype=wp.int32, device="cpu")
mesh = wp.Mesh(points=points, indices=indices)

Expected: a Python exception that names the bad index.

Actual: the process dies with a segmentation fault (exit code 139).

Mesh.refit() and assigning Mesh.points read through the indices the same way, and also crash. An index just past the end may not crash at all, and instead builds the BVH from whatever memory follows the points. On CUDA, the same reads go unchecked and nothing is reported.

wp.Mesh() also accepts an index count that isn't a multiple of 3, and silently drops the extra indices.

System Information

Warp 1.20.0.dev0 (main), Python 3.14, Linux x86_64.

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

Metadata

Metadata

Labels

bugSomething isn't workingspatial accelerationBVHs, hash grids, and the spatial queries they accelerate

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions