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

Fix double free in roaring64 andnot_inplace #556

Merged
merged 2 commits into from
Jan 14, 2024

Conversation

SLieve
Copy link
Contributor

@SLieve SLieve commented Jan 14, 2024

Fixes #555

container_iandnot frees the original container if necessary. Interestingly, as far as I can tell container_iand does not. Added a test for both.

container_iandnot frees the original container if necessary. Interestingly, as
far as I can tell container_iand does not. Added a test for both.
@SLieve SLieve requested a review from Dr-Emann January 14, 2024 10:39
@Dr-Emann
Copy link
Member

Dr-Emann commented Jan 14, 2024

It seems like this documentation for container_iandnot is inaccurate and should change, then:

* If the returned pointer is different from c1, then a new container has been
* created and the caller is responsible for freeing it.

(or maybe reworded, is it saying "if it returns a different pointer, it's a new container, and so should be freed at some point?")

In contrast to other in-place functions, which don't free the original if a
different type of container is created.
@lemire lemire merged commit 4a7474e into RoaringBitmap:master Jan 14, 2024
@SLieve SLieve deleted the r64_andnot_double_free branch January 22, 2024 21:07
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

Successfully merging this pull request may close these issues.

roaring64: andnot of range containers causes double free:
3 participants