[LLVMbugs] [Bug 12332] New: NULL dereference in MicrosoftMangle.cpp on "operator new" mangling

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 23 01:44:09 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12332

             Bug #: 12332
           Summary: NULL dereference in MicrosoftMangle.cpp on "operator
                    new" mangling
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Repro:
$ more operator_new.cpp
void f(unsigned int);

int main() {
  f(42);
  char *ptr = new char;
}

-> mangles "void f(unsigned int)" fine, crashes on mangling "void* operator
new(unsigned int) ..."

Slightly easier to repro with an intermediate var and assert:
llvm\tools\clang$ svn diff lib\AST\MicrosoftMangle.cpp
Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp (revision 153267)
+++ lib/AST/MicrosoftMangle.cpp (working copy)
@@ -767,8 +767,11 @@
       // get mangled right.
       for (FunctionDecl::param_const_iterator Parm = D->param_begin(),
            ParmEnd = D->param_end();
-           Parm != ParmEnd; ++Parm)
-        mangleType((*Parm)->getTypeSourceInfo()->getType());
+           Parm != ParmEnd; ++Parm) {
+        TypeSourceInfo *source_info = (*Parm)->getTypeSourceInfo();
+        assert(source_info);
+        mangleType(source_info->getType());
+      }
     } else {
       for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
            ArgEnd = Proto->arg_type_end();

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list