Fixed #2612 (segmentation fault of cppcheck ( <><< ))
This commit is contained in:
parent
0debba4409
commit
779dba9160
|
@ -2057,7 +2057,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
|||
{
|
||||
tok->str(tok->str() + c2);
|
||||
tok->deleteNext();
|
||||
if (c1 == '<' && tok->next()->str() == "=")
|
||||
if (c1 == '<' && Token::simpleMatch(tok->next(), "="))
|
||||
{
|
||||
tok->str("<<=");
|
||||
tok->deleteNext();
|
||||
|
|
|
@ -49,6 +49,7 @@ private:
|
|||
TEST_CASE(tokenize13); // bailout if the code contains "@" - that is not handled well.
|
||||
TEST_CASE(tokenize14); // tokenize "0X10" => 16
|
||||
TEST_CASE(tokenize15); // tokenize ".123"
|
||||
TEST_CASE(tokenize16); // #2612 - segfault for "<><<"
|
||||
|
||||
// don't freak out when the syntax is wrong
|
||||
TEST_CASE(wrong_syntax);
|
||||
|
@ -516,6 +517,12 @@ private:
|
|||
ASSERT_EQUALS("0.125", tokenizeAndStringify(".125"));
|
||||
}
|
||||
|
||||
// #2612 - segfault for "<><<"
|
||||
void tokenize16()
|
||||
{
|
||||
tokenizeAndStringify("<><<");
|
||||
}
|
||||
|
||||
void wrong_syntax()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue