mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Eliminate one uinitialized mem access related to projectiles (it's the filler
member, so maybe not *that* bad) and an invalid memory access when trying to access a per-player gamevar in a player-less context (e.g. WGR2 SVN r25 WGR2GAME.CON line 10448). git-svn-id: https://svn.eduke32.com/eduke32@2102 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a4ba86ee31
commit
b9a4b92bc8
2 changed files with 8 additions and 2 deletions
|
@ -5632,16 +5632,17 @@ static void C_InitProjectiles(void)
|
||||||
int8_t shade, xrepeat, yrepeat, pal; // 4b
|
int8_t shade, xrepeat, yrepeat, pal; // 4b
|
||||||
int8_t velmult; // 1b
|
int8_t velmult; // 1b
|
||||||
uint8_t clipdist; // 1b
|
uint8_t clipdist; // 1b
|
||||||
|
int8_t filler[6]; // 6b
|
||||||
} defaultprojectile_t;
|
} defaultprojectile_t;
|
||||||
|
|
||||||
defaultprojectile_t DefaultProjectile =
|
defaultprojectile_t DefaultProjectile =
|
||||||
{
|
{
|
||||||
1, -1, 2048, 0, 0, SMALLSMOKE, -1, -1, 600, BULLETHOLE, -1, 0, 0, 448, g_numFreezeBounces, PIPEBOMB_BOUNCE, 1,
|
1, -1, 2048, 0, 0, SMALLSMOKE, -1, -1, 600, BULLETHOLE, -1, 0, 0, 448, g_numFreezeBounces, PIPEBOMB_BOUNCE, 1,
|
||||||
100, -1, -1, -1, -1, -1, -96, 18, 18, 0, 1, 32
|
100, -1, -1, -1, -1, -1, -96, 18, 18, 0, 1, 32, {0,0,0,0,0,0},
|
||||||
};
|
};
|
||||||
|
|
||||||
// this will only happen if I forget to update this function...
|
// this will only happen if I forget to update this function...
|
||||||
if (offsetof(projectile_t, filler) != sizeof(DefaultProjectile))
|
if (sizeof(projectile_t) != sizeof(DefaultProjectile))
|
||||||
G_GameExit("ERROR: C_InitProjectiles(): projectile_t mismatch!");
|
G_GameExit("ERROR: C_InitProjectiles(): projectile_t mismatch!");
|
||||||
|
|
||||||
for (i=MAXTILES-1; i>=0; i--)
|
for (i=MAXTILES-1; i>=0; i--)
|
||||||
|
|
|
@ -803,6 +803,11 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
|
||||||
default:
|
default:
|
||||||
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
||||||
case GAMEVAR_PERPLAYER:
|
case GAMEVAR_PERPLAYER:
|
||||||
|
if ((unsigned)vm.g_p >= MAXPLAYERS)
|
||||||
|
{
|
||||||
|
id = vm.g_p;
|
||||||
|
goto badplayer;
|
||||||
|
}
|
||||||
return ((aGameVars[id].val.plValues[vm.g_p] ^ -negateResult) + negateResult);
|
return ((aGameVars[id].val.plValues[vm.g_p] ^ -negateResult) + negateResult);
|
||||||
case GAMEVAR_PERACTOR:
|
case GAMEVAR_PERACTOR:
|
||||||
return ((aGameVars[id].val.plValues[vm.g_i] ^ -negateResult) + negateResult);
|
return ((aGameVars[id].val.plValues[vm.g_i] ^ -negateResult) + negateResult);
|
||||||
|
|
Loading…
Reference in a new issue