mirror of
https://github.com/ZDoom/acc.git
synced 2024-11-15 00:41:30 +00:00
- Fixed: There was no check for accessing an array without filling out all the required dimensions.
SVN r3409 (trunk)
This commit is contained in:
parent
3386968b3d
commit
6c45d91701
3 changed files with 7 additions and 0 deletions
1
error.c
1
error.c
|
@ -160,6 +160,7 @@ static struct
|
|||
{ ERR_MISSING_RBRACKET, "Missing ']'." },
|
||||
{ ERR_ZERO_DIMENSION, "Arrays cannot have a dimension of zero." },
|
||||
{ ERR_TOO_MANY_DIM_USED, "%s only has %d dimensions." },
|
||||
{ ERR_TOO_FEW_DIM_USED, "%s access needs %d more dimensions." },
|
||||
{ ERR_ARRAY_MAPVAR_ONLY, "Only map variables can be arrays." },
|
||||
{ ERR_NOT_AN_ARRAY, "%s is not an array." },
|
||||
{ ERR_MISSING_LBRACE_ARR, "Missing opening '{' in array initializer." },
|
||||
|
|
1
error.h
1
error.h
|
@ -125,6 +125,7 @@ typedef enum
|
|||
ERR_MISSING_RBRACKET,
|
||||
ERR_ZERO_DIMENSION,
|
||||
ERR_TOO_MANY_DIM_USED,
|
||||
ERR_TOO_FEW_DIM_USED,
|
||||
ERR_TOO_MANY_ARRAY_INIT,
|
||||
ERR_EOF,
|
||||
ERR_ARRAY_MAPVAR_ONLY,
|
||||
|
|
5
parse.c
5
parse.c
|
@ -4034,6 +4034,11 @@ static void ParseArrayIndices(symbolNode_t *sym, int requiredIndices)
|
|||
TK_TokenMustBe(TK_RBRACKET, ERR_MISSING_RBRACKET);
|
||||
TK_NextToken();
|
||||
}
|
||||
if(i < requiredIndices)
|
||||
{
|
||||
ERR_Error(ERR_TOO_FEW_DIM_USED, YES,
|
||||
sym->name, requiredIndices - i);
|
||||
}
|
||||
// if there were unspecified indices, multiply the offset by their sizes [JB]
|
||||
if(requiredIndices < sym->info.array.ndim - 1)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue