Skip to content

Fix exception safety violation in AbiBuffer::advance#1649

Merged
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
Evian-Zhang:abibuffer-advance-fix
Jul 6, 2026
Merged

Fix exception safety violation in AbiBuffer::advance#1649
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
Evian-Zhang:abibuffer-advance-fix

Conversation

@Evian-Zhang

Copy link
Copy Markdown
Contributor

Fix #1646

let (mut ptr, len) = self.abi_ptr_and_len();
assert!(amt <= len);
for _ in 0..amt {
// Update self.cursor incrementally for exception safety

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this expand on what it means by "exception safety"? For example something along the lines of handling the case where dealloc_lists panics we've at least flagged the rest of the buffer as not being advanced but this particular element won't be handled again.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added :)

@alexcrichton alexcrichton reopened this Jul 6, 2026
@alexcrichton alexcrichton enabled auto-merge July 6, 2026 15:08
@alexcrichton alexcrichton added this pull request to the merge queue Jul 6, 2026
Merged via the queue into bytecodealliance:main with commit 1ccc7c7 Jul 6, 2026
29 of 58 checks passed
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.

AbiBuffer::advance is not exception safe, leading to use after free

2 participants