Skip to content

[Demangler] Fix assertion failure. #72653

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

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Conversation

al45tair
Copy link
Contributor

It's illegal to call node->addChild() with a NULL child argument; it's possible to construct unexpected Node trees by passing invalid manglings, and in this case that was causing popTypeAndGetChild() to fail (because the top node was not a Type node), which then meant that the call to addChild had a NULL child argument.

The simplest fix is to use createWithChildren() to do the node construction, because that function checks its arguments for NULLs.

rdar://125350219

It's illegal to call `node->addChild()` with a `NULL` child argument;
it's possible to construct unexpected `Node` trees by passing invalid
manglings, and in this case that was causing `popTypeAndGetChild()` to
fail (because the top node was not a `Type` node), which then meant
that the call to `addChild` had a `NULL` child argument.

The simplest fix is to use `createWithChildren()` to do the node
construction, because that function checks its arguments for `NULL`s.

rdar://125350219
@al45tair al45tair requested a review from meg-gupta March 28, 2024 10:39
@al45tair
Copy link
Contributor Author

@swift-ci Please smoke test

Copy link
Contributor

@meg-gupta meg-gupta left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@al45tair al45tair merged commit 644c933 into swiftlang:main Mar 28, 2024
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