Skip to content

NULL dereference in MicrosoftMangle.cpp on "operator new" mangling #12704

@timurrrr

Description

@timurrrr
Bugzilla Link 12332
Resolution FIXED
Resolved on Mar 19, 2014 03:27
Version trunk
OS Windows NT
Blocks llvm/llvm-bugzilla-archive#12477
CC @DougGregor,@rjmccall

Extended Description

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();

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillac++

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions