Fixed crash in CheckVaarg::va_list_usage() (#7559)

This commit is contained in:
PKEuS 2016-06-20 09:24:23 +02:00
parent 4f8594a9e0
commit 721bc32b2d
2 changed files with 13 additions and 0 deletions

View File

@ -129,6 +129,8 @@ void CheckVaarg::va_list_usage()
while (scope->nestedIn && scope->type != Scope::eFor && scope->type != Scope::eWhile && scope->type != Scope::eDo && scope->type != Scope::eSwitch) while (scope->nestedIn && scope->type != Scope::eFor && scope->type != Scope::eWhile && scope->type != Scope::eDo && scope->type != Scope::eSwitch)
scope = scope->nestedIn; scope = scope->nestedIn;
tok = scope->classEnd; tok = scope->classEnd;
if (!tok)
return;
} else if (_tokenizer->isCPP() && tok->str() == "try") { } else if (_tokenizer->isCPP() && tok->str() == "try") {
open = false; open = false;
break; break;

View File

@ -299,6 +299,17 @@ private:
" BG_TString result(f);\n" " BG_TString result(f);\n"
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
// #7559
check("void mowgli_object_message_broadcast(mowgli_object_t *self, const char *name, ...) {\n"
" va_list va;\n"
" MOWGLI_LIST_FOREACH(n, self->klass->message_handlers.head) {\n"
" if (!strcasecmp(sig2->name, name))\n"
" break;\n"
" }\n"
" va_start(va, name);\n"
" va_end(va);\n"
"}");
} }
}; };