Demangle: Fix crash-on-invalid demangling of a module name with no underlying entity

This commit is contained in:
David Blaikie 2022-03-30 20:18:40 +00:00
parent c31af7cfe3
commit 6f5ecd089f
3 changed files with 3 additions and 2 deletions

View File

@ -2885,7 +2885,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseUnqualifiedName(
Result = getDerived().parseOperatorName(State);
}
if (Module)
if (Result != nullptr && Module != nullptr)
Result = make<ModuleEntity>(Module, Result);
if (Result != nullptr)
Result = getDerived().parseAbiTags(Result);

View File

@ -30172,6 +30172,7 @@ const char* invalid_cases[] =
"_ZWDC3FOOEv",
"_ZGI3Foo",
"_ZGIW3Foov",
"W1x",
};
const unsigned NI = sizeof(invalid_cases) / sizeof(invalid_cases[0]);

View File

@ -2885,7 +2885,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseUnqualifiedName(
Result = getDerived().parseOperatorName(State);
}
if (Module)
if (Result != nullptr && Module != nullptr)
Result = make<ModuleEntity>(Module, Result);
if (Result != nullptr)
Result = getDerived().parseAbiTags(Result);