[PATCH 8/8] [Msvcrt]: symbol undecoration: really check that we get a template string before making use of it

Eric Pouech eric.pouech at orange.fr
Mon Jan 21 15:06:11 CST 2008




A+
---

 dlls/msvcrt/tests/cpp.c |    1 +
 dlls/msvcrt/undname.c   |   13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/msvcrt/tests/cpp.c b/dlls/msvcrt/tests/cpp.c
index 85544c0..2788a56 100644
--- a/dlls/msvcrt/tests/cpp.c
+++ b/dlls/msvcrt/tests/cpp.c
@@ -984,6 +984,7 @@ static void test_demangle(void)
 {"?$AAA@$DBAB@", "AAA<`template-parameter257'>"},
 {"?$AAA@$D?4@", "AAA<`template-parameter-5'>"},
 {"?$AAA at PAUBBB@@", "AAA<struct BBB *>"},
+{"??$ccccc at PAVaaa@@@bar at bb@foo@@DGPAV0 at PAV0@PAVee@@IPAPAVaaa@@1 at Z", "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa **,class ee *)"},
     };
     int i, num_test = (sizeof(test)/sizeof(test[0]));
     char* name;
diff --git a/dlls/msvcrt/undname.c b/dlls/msvcrt/undname.c
index d88cf79..dfc2241 100644
--- a/dlls/msvcrt/undname.c
+++ b/dlls/msvcrt/undname.c
@@ -538,8 +538,8 @@ static BOOL get_class(struct parsed_symbol* sym)
             if (*++sym->current == '$') 
             {
                 sym->current++;
-                name = get_template_name(sym);
-                str_array_push(sym, name, -1, &sym->names);
+                if ((name = get_template_name(sym)))
+                    str_array_push(sym, name, -1, &sym->names);
             }
             break;
         default:
@@ -1292,17 +1292,17 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
             str_array_push(sym, function_name, -1, &sym->stack);
             break;
         }
-        sym->stack.start = 1;
     }
     else if (*sym->current == '$')
     {
         /* Strange construct, it's a name with a template argument list
            and that's all. */
         sym->current++;
-        sym->result = get_template_name(sym);
-        ret = TRUE;
+        ret = (sym->result = get_template_name(sym)) != NULL;
         goto done;
     }
+    else if (*sym->current == '?' && sym->current[1] == '$')
+        do_after = 5;
 
     /* Either a class name, or '@' if the symbol is not a class member */
     switch (*sym->current)
@@ -1331,6 +1331,9 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
     case 3:
         sym->flags &= ~UNDNAME_NO_FUNCTION_RETURNS;
         break;
+    case 5:
+        sym->names.start = 1;
+        break;
     }
 
     /* Function/Data type and access level */





More information about the wine-patches mailing list