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

Add UB check to FreeListAllocator::deallocate #2658

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

marc0246
Copy link
Contributor

This, together with the existing check that the suballocation is not already free, ensures that all UB that can arise from FreeListAllocator::deallocate is caught with debug assertions on. Of course, since there are raw pointers in use, it's always going to stay unsafe because the user could supply a pointer with the right address but the wrong provenance. But that would require going out of your way to do that specifically. On the other hand, using something "safe" like an index means that it might not be possible to catch the UB where you allocate using one suballocator and deallocate using another because indices are relative, which this catches because pointers are absolute. So in some sense I consider this safer.

@Rua Rua merged commit 63615d9 into vulkano-rs:master Feb 28, 2025
8 checks passed
@marc0246 marc0246 deleted the allocator-ub-checks branch February 28, 2025 10:17
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.

2 participants