Ticket #7270 segmentation fault (invalid code) in Tokenizer::simplifyLabelsCaseDefault. include fix for cygwin
This commit is contained in:
parent
7cb27d91c4
commit
bd2892fde4
|
@ -2309,6 +2309,8 @@ void Tokenizer::simplifyLabelsCaseDefault()
|
|||
break;
|
||||
if (tok->str() != "case" && tok->next() && tok->next()->str() == ":") {
|
||||
tok = tok->next();
|
||||
if (!tok->next())
|
||||
syntaxError(tok); // #7270 invalid code
|
||||
if (tok->next()->str() != ";" && tok->next()->str() != "case")
|
||||
tok->insertToken(";");
|
||||
else
|
||||
|
|
|
@ -219,6 +219,7 @@ private:
|
|||
TEST_CASE(garbageCode168); // #7246
|
||||
TEST_CASE(garbageCode169); // #6731
|
||||
TEST_CASE(garbageCode170);
|
||||
TEST_CASE(garbageCode171);
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
TEST_CASE(garbageAST);
|
||||
|
@ -1442,6 +1443,11 @@ private:
|
|||
checkCode("d i(){{f*s=typeid(()0,)}}", false);
|
||||
}
|
||||
|
||||
void garbageCode171() {
|
||||
// 7270
|
||||
ASSERT_THROW(checkCode("(){case()?():}:", false), InternalError);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestGarbage)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "options.h"
|
||||
#include "redirect.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
|
|
Loading…
Reference in New Issue