-
Notifications
You must be signed in to change notification settings - Fork 13.5k
NULL dereference in MicrosoftMangle.cpp on "operator new" mangling #12704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
assigned to @timurrrr |
FTR, this was run with: $ clang++.exe |
Same assertion is hit on: |
The problem seems to be fixable by taking a different branch of an if/else in the code. I'm not sure how to change the "if (D) {" condition properly though Index: lib/AST/MicrosoftMangle.cpp--- lib/AST/MicrosoftMangle.cpp (revision 153267)
|
I committed your patch as r155879, thanks! |
mentioned in issue llvm/llvm-bugzilla-archive#12477 |
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();
for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
ArgEnd = Proto->arg_type_end();
The text was updated successfully, but these errors were encountered: