-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Hi, thanks for your contribution to this great engine.
However, we have found some unsound problems in the crate pleco_engine
.
For example, insert_score_depth
and insert_score
use get_unchecked_mut
to access target RootMove
without boundary checking for performance consideration.
These functions are actually unsafe since they ask the caller to guarantee the index
is in-bound and the compiler fails to check this.
It is certainly ok to mark the unsafe functions as safe and use them with care in 'pleco'.
But considering the crate pleco_engine
is available in crates.io and these functions are public, we think it's still necessary to make these functions more sound.
Suggestions
Here are some action choices we suggested:
- Mark these functions as 'unsafe' which would lead to large code changes.
- (recommended) Add
assert!
or at leastdebug_assert!
macros to validate that theindex
is in-bound.
Metadata
Metadata
Assignees
Labels
No labels