Fix crash in arraySize() (#4556)
* Fix #11355 FN: arrayIndexOutOfBounds * Fix * Fix crash in arraySize()
This commit is contained in:
parent
49f1282ce1
commit
192c30ab1d
|
@ -3161,7 +3161,7 @@ void Tokenizer::arraySize()
|
|||
{
|
||||
auto getStrTok = [](Token* tok, bool addLength, Token** endStmt) -> Token* {
|
||||
if (addLength) {
|
||||
*endStmt = tok->tokAt(6);
|
||||
*endStmt = tok->tokAt(5);
|
||||
return tok->tokAt(4);
|
||||
}
|
||||
if (Token::Match(tok, "%var% [ ] =")) {
|
||||
|
|
|
@ -4013,6 +4013,7 @@ private:
|
|||
ASSERT_EQUALS("; int a [ 3 ] = { [ 2 ] = 5 } ;", tokenizeAndStringify(";int a[]={ [2] = 5 };"));
|
||||
ASSERT_EQUALS("; int a [ 5 ] = { 1 , 2 , [ 2 ] = 5 , 3 , 4 } ;", tokenizeAndStringify(";int a[]={ 1, 2, [2] = 5, 3, 4 };"));
|
||||
ASSERT_EQUALS("; int a [ ] = { 1 , 2 , [ x ] = 5 , 3 , 4 } ;", tokenizeAndStringify(";int a[]={ 1, 2, [x] = 5, 3, 4 };"));
|
||||
ASSERT_EQUALS("; const char c [ 4 ] = \"abc\" ;", tokenizeAndStringify(";const char c[] = { \"abc\" };"));
|
||||
}
|
||||
|
||||
void labels() {
|
||||
|
|
Loading…
Reference in New Issue