Fix overrun in decl_initializer_alloc.
This bug was reported on http://lists.gnu.org/archive/html/tinycc-devel/2009-03/msg00035.html This happens because parser of array initializer doesn't stop to read until semi-colon or comma.
This commit is contained in:
parent
040ef000e4
commit
af6cbc48d1
1 changed files with 4 additions and 2 deletions
6
tcc.c
6
tcc.c
|
@ -9176,9 +9176,11 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
|
||||||
if (tok == '{')
|
if (tok == '{')
|
||||||
level++;
|
level++;
|
||||||
else if (tok == '}') {
|
else if (tok == '}') {
|
||||||
if (level == 0)
|
|
||||||
break;
|
|
||||||
level--;
|
level--;
|
||||||
|
if (level <= 0) {
|
||||||
|
next();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue