- Applied Zom-B's patch for multi-dimension array initializer checks.

SVN r3281 (trunk)
This commit is contained in:
Braden Obrzut 2011-08-17 07:24:38 +00:00
parent 9d2a8cf45e
commit 6e0f75a4d1

11
parse.c
View file

@ -4071,6 +4071,17 @@ static void ProcessArrayLevel(int level, int *entry, int ndim,
} }
else else
{ {
//Bugfix for r3226 by Zom-B
if (i >= dims[level - 1])
{
if (!warned_too_many)
{
warned_too_many = YES;
ERR_Error(ERR_TOO_MANY_ARRAY_INIT, YES);
}
// Allow execution to continue without stray memory access
entry -= muls[level-1];
}
TK_TokenMustBe(TK_LBRACE, ERR_MISSING_LBRACE_ARR); TK_TokenMustBe(TK_LBRACE, ERR_MISSING_LBRACE_ARR);
TK_NextToken(); TK_NextToken();
ProcessArrayLevel(level+1, entry, ndim, dims, muls, name); ProcessArrayLevel(level+1, entry, ndim, dims, muls, name);