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
Fix out-of-bounds access possibility in safe code.
With the `id` and `tree` fields of `NodeRef` and `NodeMut` being public,
it was possible to assign to them.
For example, it was possible to build a `NodeMut`
for large ID/index in a small tree/Vec.
Since some APIs use unchecked indexing, this would let users of this library
cause out-of-bounds access in a `Vec` without writing `unsafe` code themselves.
This commit fixes that issue by making the fields private
and instead providing read-only access via accessor methods.
Now the fields can only be set by the `ego-tree` crate,
which can make sure to only ever use an ID that is in-bounds for a given tree.
0 commit comments