mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
gameexec.c: In VM_OnEvent_, don't form address like &sprite[-1].
The practical rationale: Clang-sanitize catches this, so this is bad. The real rationale: I *think* it is undefined behavior to even form such a pointer in C99. However, I would be hard pressed to provide a nice formal argument in terms of the Standard wording right now. It looks like 6.5.3.2#4 is to blame. git-svn-id: https://svn.eduke32.com/eduke32@4727 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
737af0387e
commit
e278842ce4
1 changed files with 12 additions and 1 deletions
|
@ -137,7 +137,13 @@ int32_t VM_OnEvent_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t l
|
|||
if (ret == 1)
|
||||
VM_KillIt(iActor, iPlayer);
|
||||
#else
|
||||
vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0], &sprite[iActor], 0 }, vm_backup = vm;
|
||||
const vmstate_t vm_backup = vm;
|
||||
vmstate_t tempvm = {
|
||||
iActor, iPlayer, lDist,
|
||||
NULL, NULL, // to be set in a moment
|
||||
0
|
||||
};
|
||||
|
||||
int32_t backupReturnVar = aGameVars[g_iReturnVarID].val.lValue;
|
||||
int32_t backupEventExec = g_currentEventExec;
|
||||
intptr_t *oinsptr=insptr;
|
||||
|
@ -150,6 +156,11 @@ int32_t VM_OnEvent_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t l
|
|||
tempvm.g_sp = &dummy_sprite;
|
||||
tempvm.g_t = dummy_t;
|
||||
}
|
||||
else
|
||||
{
|
||||
tempvm.g_sp = &sprite[iActor];
|
||||
tempvm.g_t = &actor[iActor].t_data[0];
|
||||
}
|
||||
|
||||
vm = tempvm;
|
||||
|
||||
|
|
Loading…
Reference in a new issue