mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-272 - Gnu Demangler - fixed demangler failure on function parameter
that has more than 2 sets of parentheses
This commit is contained in:
@@ -755,7 +755,7 @@ public class GnuDemanglerParser {
|
||||
else {
|
||||
int startParenCount =
|
||||
StringUtilities.countOccurrences(datatype.substring(i), '(');
|
||||
boolean hasPointerParens = startParenCount == 2;
|
||||
boolean hasPointerParens = startParenCount >= 2;
|
||||
if (hasPointerParens) {
|
||||
Demangled namespace = ddt.getNamespace();
|
||||
DemangledFunctionPointer dfp = parseFunctionPointer(datatype);
|
||||
|
||||
@@ -1540,6 +1540,37 @@ public class GnuDemanglerParserTest extends AbstractGenericTest {
|
||||
signature);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFunctionParameterWithMultipleParentheses() throws Exception {
|
||||
|
||||
//
|
||||
// Mangled: __ZN7WebCore12TextCodecICU14registerCodecsEPFvPKcON3WTF8FunctionIFNSt3__110unique_ptrINS_9TextCodecENS5_14default_deleteIS7_EEEEvEEEE
|
||||
//
|
||||
// Demangled: undefined WebCore::TextCodecICU::registerCodecs(void ()(char const *,WTF::Function<std::__1::unique_ptr<WebCore::TextCodec,std::__1::default_delete<WebCore::TextCodec>> ()> &&))
|
||||
//
|
||||
// The regression tested here revolves around this parameter:
|
||||
//
|
||||
// void ()(char const *,WTF::Function<std::__1::unique_ptr<WebCore::TextCodec,std::__1::default_delete<WebCore::TextCodec>> ()> &&
|
||||
//
|
||||
// (note the trailing '()' chars)
|
||||
//
|
||||
|
||||
DemangledObject object = parser.parse(
|
||||
"__ZN7WebCore12TextCodecICU14registerCodecsEPFvPKcON3WTF8FunctionIFNSt3__110unique_ptrINS_9TextCodecENS5_14default_deleteIS7_EEEEvEEEE",
|
||||
"undefined WebCore::TextCodecICU::registerCodecs(void ()(char const *,WTF::Function<std::__1::unique_ptr<WebCore::TextCodec,std::__1::default_delete<WebCore::TextCodec>> ()> &&))");
|
||||
|
||||
assertNotNull(object);
|
||||
assertType(object, DemangledFunction.class);
|
||||
|
||||
String name = "registerCodecs";
|
||||
assertName(object, name, "WebCore", "TextCodecICU");
|
||||
|
||||
String signature = object.getSignature(false);
|
||||
assertEquals(
|
||||
"undefined WebCore::TextCodecICU::registerCodecs(void ()(char const *,WTF::Function<std::__1::unique_ptr<WebCore::TextCodec,std::__1::default_delete<WebCore::TextCodec>> ()> &&))",
|
||||
signature);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFunctionWithVarargsRvalueParameter() throws Exception {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user