You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harden UnionFind bindings and mutex-watershed neighbor bounds
B2: validate node ids at the UnionFind binding boundary. UnionFind::find/
merge/merge_to index their parent vectors without a bounds check (intentional
for the hot path), but the scalar and array bindings passed user-supplied ids
straight through, so an out-of-range id was undefined behavior / a segfault
from Python. Add check_node() and route the scalar find/merge/merge_to binds
and the merge_edges/find_nodes helpers through it, throwing std::invalid_argument
before releasing the GIL.
B1: route the mutex-watershed and semantic-mutex-watershed neighbor computation
through detail::valid_offset_target instead of an unchecked flat-index shift.
This bounds-checks the neighbor per axis, so the kernel is memory-safe and
rejects row/plane wrap-around independently of the caller's valid_edges mask.
Drops the now-unused offset_strides precompute.
Add regression tests for the new UnionFind validation and for the existing
binding-layer point-coordinate validation in non_maximum_distance_suppression.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments