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

Make some safety guarantees about deserialize_safe & internal_validate functions #662

Closed
Dr-Emann opened this issue Sep 19, 2024 · 4 comments · Fixed by #675
Closed

Make some safety guarantees about deserialize_safe & internal_validate functions #662

Dr-Emann opened this issue Sep 19, 2024 · 4 comments · Fixed by #675

Comments

@Dr-Emann
Copy link
Member

At least for rust bindings, I'd like to be able to guarantee that:

  • roaring{,64}_bitmap_internal_validate will never lead to Undefined Behavior (segfaults, etc) when called on a bitmap returned from a deserialize_safe function
  • If roaring{,64}_bitmap_internal_validate returns true on a bitmap returned from a deserialize_safe function, that bitmap is valid and no valid use of that bitmap can lead to Undefined Behavior.
  • Calling roaring{,64}_bitmap_free/roaring_bitmap_clear on a bitmap returned from a deserialize_safe function - even if the bitmap would return false from internal_validate - will not lead to undefined behavior or memory leaks.

Originally posted by @Dr-Emann in #661 (comment)

@lemire
Copy link
Member

lemire commented Sep 19, 2024

The first step would be to add testing.

Contributions welcome!

@lemire
Copy link
Member

lemire commented Oct 5, 2024

@Dr-Emann Bugs are always possible, but I think that we have made significant steps forward.

I would recommend closing this issue. From now on, if any of the statements you make is found to be untrue, we have a bug.

Thoughts?

@Dr-Emann
Copy link
Member Author

Dr-Emann commented Oct 5, 2024

Works for me. The rust fuzzers have been running for the past 2 weeks with no findings.

Do we want to put any of the guarantees into the header itself?

@lemire
Copy link
Member

lemire commented Oct 6, 2024

Ok. I will issue a PR about guarantees.

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

Successfully merging a pull request may close this issue.

2 participants