Skip to content

Commit 6d5d4e6

Browse files
Merge pull request #37331 from adrian-prantl/77530286
Add a missing check for the number of children before accessing them.
2 parents cf2c052 + a50c048 commit 6d5d4e6

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)