Skip to content

Commit a50c048

Browse files
committed
Add a missing check for the number of children before accessing them.
parentDemangling is going to be added as the first child of the return node, so we can't construct one unless we have both children. rdar://77530286
1 parent c40a083 commit a50c048

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/swift/Remote/MetadataReader.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,6 +2477,9 @@ class MetadataReader {
24772477
// Use private declaration names for anonymous context references.
24782478
if (parentDemangling->getKind() == Node::Kind::AnonymousContext
24792479
&& nameNode->getKind() == Node::Kind::Identifier) {
2480+
if (parentDemangling->getNumChildren() < 2)
2481+
return nullptr;
2482+
24802483
auto privateDeclName =
24812484
dem.createNode(Node::Kind::PrivateDeclName);
24822485
privateDeclName->addChild(parentDemangling->getChild(0), dem);

0 commit comments

Comments
 (0)