Fix 9052: Crash: SIGSEGV in Token::previous (this=0x0) while checking mariadb-10.0
This commit is contained in:
parent
194631ff9c
commit
91138578cc
|
@ -5470,7 +5470,7 @@ void SymbolDatabase::setValueTypeInTokenList()
|
|||
setValueType(tok, vt);
|
||||
} else if (tok->str() == "return" && tok->scope()) {
|
||||
const Function *function = tok->scope()->function;
|
||||
if (function) {
|
||||
if (function && function->retDef) {
|
||||
ValueType vt;
|
||||
parsedecl(function->retDef, &vt, mDefaultSignedness, mSettings);
|
||||
setValueType(tok, vt);
|
||||
|
|
|
@ -481,6 +481,9 @@ private:
|
|||
TEST_CASE(findGarbageCode);
|
||||
TEST_CASE(checkEnableIf);
|
||||
|
||||
// #9052
|
||||
TEST_CASE(noCrash1);
|
||||
|
||||
// --check-config
|
||||
TEST_CASE(checkConfiguration);
|
||||
|
||||
|
@ -8783,6 +8786,14 @@ private:
|
|||
|
||||
}
|
||||
|
||||
void noCrash1() {
|
||||
ASSERT_NO_THROW(tokenizeAndStringify(
|
||||
"struct A {\n"
|
||||
" A( const std::string &name = "" );\n"
|
||||
"};\n"
|
||||
"A::A( const std::string &name ) { return; }\n"))
|
||||
}
|
||||
|
||||
void checkConfig(const char code[]) {
|
||||
errout.str("");
|
||||
|
||||
|
|
Loading…
Reference in New Issue