mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 06:32:37 +00:00
Add tilenum bound check to CON *actor blocks when parsing, fix the other ones.
The remaining checks now "continue;" when an oob tilenum is found where an oob access would ensue else. Also, it's now checked for negative numbers (the message remains the same though). git-svn-id: https://svn.eduke32.com/eduke32@2651 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
88ca3a913a
commit
0b055de591
1 changed files with 22 additions and 11 deletions
|
@ -2693,6 +2693,13 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
g_scriptPtr--;
|
g_scriptPtr--;
|
||||||
|
|
||||||
|
if ((unsigned)*g_scriptPtr >= MAXTILES)
|
||||||
|
{
|
||||||
|
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
||||||
|
g_numCompilerErrors++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (tw == CON_EVENTLOADACTOR)
|
if (tw == CON_EVENTLOADACTOR)
|
||||||
{
|
{
|
||||||
actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr;
|
actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr;
|
||||||
|
@ -3944,17 +3951,18 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
j = *(g_scriptPtr-1);
|
j = *(g_scriptPtr-1);
|
||||||
|
|
||||||
if (j > MAXTILES-1)
|
|
||||||
{
|
|
||||||
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
|
||||||
g_numCompilerErrors++;
|
|
||||||
}
|
|
||||||
|
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
y = *(g_scriptPtr-1);
|
y = *(g_scriptPtr-1);
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
z = *(g_scriptPtr-1);
|
z = *(g_scriptPtr-1);
|
||||||
|
|
||||||
|
if ((unsigned)j >= MAXTILES)
|
||||||
|
{
|
||||||
|
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
||||||
|
g_numCompilerErrors++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (y)
|
switch (y)
|
||||||
{
|
{
|
||||||
case PROJ_WORKSLIKE:
|
case PROJ_WORKSLIKE:
|
||||||
|
@ -4029,14 +4037,16 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
g_scriptPtr--;
|
g_scriptPtr--;
|
||||||
j = *g_scriptPtr;
|
j = *g_scriptPtr;
|
||||||
|
|
||||||
if (j > MAXTILES-1)
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
|
g_scriptPtr--;
|
||||||
|
|
||||||
|
if ((unsigned)j >= MAXTILES)
|
||||||
{
|
{
|
||||||
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
||||||
g_numCompilerErrors++;
|
g_numCompilerErrors++;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
|
||||||
g_scriptPtr--;
|
|
||||||
SpriteFlags[j] = *g_scriptPtr;
|
SpriteFlags[j] = *g_scriptPtr;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -4061,10 +4071,11 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
g_scriptPtr--;
|
g_scriptPtr--;
|
||||||
j = *g_scriptPtr;
|
j = *g_scriptPtr;
|
||||||
|
|
||||||
if (j > MAXTILES-1)
|
if ((unsigned)j >= MAXTILES)
|
||||||
{
|
{
|
||||||
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
||||||
g_numCompilerErrors++;
|
g_numCompilerErrors++;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tw)
|
switch (tw)
|
||||||
|
@ -4086,7 +4097,7 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
C_GetNextValue(LABEL_DEFINE);
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
g_scriptPtr--;
|
g_scriptPtr--;
|
||||||
i = *g_scriptPtr;
|
i = *g_scriptPtr;
|
||||||
if (i > MAXTILES-1)
|
if ((unsigned)i >= MAXTILES)
|
||||||
{
|
{
|
||||||
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
C_ReportError(ERROR_EXCEEDSMAXTILES);
|
||||||
g_numCompilerErrors++;
|
g_numCompilerErrors++;
|
||||||
|
|
Loading…
Reference in a new issue