Skip to content

Fix visit case use after free - #88

Merged
jcmosc merged 2 commits into
mainfrom
fix-visit-case-use-after-free
Oct 23, 2026
Merged

jcmosc merged 2 commits into
mainfrom
fix-visit-case-use-after-free

Conversation

@jcmosc

@jcmosc jcmosc commented Oct 22, 2026

Copy link
Copy Markdown
Owner

No description provided.

jcmosc and others added 2 commits October 22, 2026 18:19
When the payload type of an enum case could not be resolved, visit_case
popped the EnumItem from the items vector, destroying the case that
_current_enum_case pointed into, and then fell through to code that read
the case's children and popped it from the destroyed EnumItem.

Return immediately after popping the EnumItem instead, restoring the enum
case depth and current enum case, as the original implementation does.
Callers already revert their items when visit_case returns false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t_case

The item count passed to revert() was read after visiting the payload
type, so the revert never removed anything. Read it before the visit, as
the original implementation and visit_element do. This does not change
the resulting layout, since the case's children are cleared immediately
after reverting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jcmosc
jcmosc merged commit 4c574a2 into main Oct 23, 2026
2 checks passed
@jcmosc
jcmosc deleted the fix-visit-case-use-after-free branch October 23, 2026 10:47
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.

1 participant