Repository navigation
Handle allocation failure and zero-sized types - #17
Merged
Merged
Conversation
pre_push wrote through the pointer returned by alloc without checking for null, so an allocation failure was undefined behavior. It now calls handle_alloc_error. For a zero-sized T the bin layouts have size zero, and calling alloc or dealloc with a zero-size layout is undefined behavior (Miri reports it). We now use a dangling pointer for those bins and never free it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
droundy
added a commit
that referenced
this pull request
Oct 18, 2026
Resolve conflicts with #17 by keeping its allocation-failure and zero-sized-type handling, using core/alloc paths instead of std. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two pre-existing undefined-behavior bugs in
pre_push:allocwas written through without a null check. It now callshandle_alloc_error, asVecdoes.AppendOnlyVec<()>(or any ZST) every bin layout has size zero, andalloc/deallocwith a zero-size layout is UB. Miri reportscreating allocation with size 0onmain. These bins now useNonNull::dangling()andDropskips freeing them.Adds
test_zero_sized, which fails undercargo +nightly miri testbefore this change and passes after.These matter more once #16 lands, since embedded heaps are small enough for allocation failure to be realistic.
🤖 Generated with Claude Code