Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsoundness in perpetual #2149

Open
lwz23 opened this issue Dec 1, 2024 · 0 comments
Open

Unsoundness in perpetual #2149

lwz23 opened this issue Dec 1, 2024 · 0 comments

Comments

@lwz23
Copy link

lwz23 commented Dec 1, 2024

see perpetual-ml/perpetual#34 for detail.
Description
Both from_parent_child and from_parent_two_children functions use unsafe { hist_tree.get_unchecked(...) } to access elements of the hist_tree slice without bounds checking. This is unsafe and can result in undefined behavior (UB) if the provided indices (root_num, child_num, update_num, first_num, second_num) are out of bounds. The lack of bounds checking makes these functions unsound.

declear histogram as a pub mod and from_parent_child , from_parent_two_children as pub function cause the result. According to the authors, these two functions should not be used externally, so it is possible to fix these problems by changing them to pub(crate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant