mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
Fix sintable[] access with out-of-bounds values in core engine functions
(getzrange, hitscan, clipmove, drawmapview). They're reproducible with DNE1.3D; Since these angle values most likely come from CON code, my suggestion would be to bit-and all values representing angles with 2047 when setting the from CON, but I'd have to think about potential side-effects of doing this. git-svn-id: https://svn.eduke32.com/eduke32@2170 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
151287168c
commit
3ca41992dd
1 changed files with 7 additions and 4 deletions
|
@ -8690,7 +8690,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
||||||
if ((spr->cstat&4) > 0) xoff = -xoff;
|
if ((spr->cstat&4) > 0) xoff = -xoff;
|
||||||
if ((spr->cstat&8) > 0) yoff = -yoff;
|
if ((spr->cstat&8) > 0) yoff = -yoff;
|
||||||
|
|
||||||
k = spr->ang;
|
k = spr->ang&2047; // FIXME ? See DNE_BUG_HERE
|
||||||
cosang = sintable[(k+512)&2047]; sinang = sintable[k];
|
cosang = sintable[(k+512)&2047]; sinang = sintable[k];
|
||||||
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
||||||
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
||||||
|
@ -11230,7 +11230,7 @@ restart_grand:
|
||||||
if ((cstat&4) > 0) xoff = -xoff;
|
if ((cstat&4) > 0) xoff = -xoff;
|
||||||
if ((cstat&8) > 0) yoff = -yoff;
|
if ((cstat&8) > 0) yoff = -yoff;
|
||||||
|
|
||||||
ang = spr->ang;
|
ang = spr->ang&2047; // FIXME ? See DNE_BUG_HERE
|
||||||
cosang = sintable[(ang+512)&2047]; sinang = sintable[ang];
|
cosang = sintable[(ang+512)&2047]; sinang = sintable[ang];
|
||||||
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
||||||
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
||||||
|
@ -12042,7 +12042,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
|
||||||
if ((cstat&4) > 0) xoff = -xoff;
|
if ((cstat&4) > 0) xoff = -xoff;
|
||||||
if ((cstat&8) > 0) yoff = -yoff;
|
if ((cstat&8) > 0) yoff = -yoff;
|
||||||
|
|
||||||
k = spr->ang;
|
k = spr->ang&2047; // FIXME ? See DNE_BUG_HERE
|
||||||
cosang = sintable[(k+512)&2047]; sinang = sintable[k];
|
cosang = sintable[(k+512)&2047]; sinang = sintable[k];
|
||||||
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
||||||
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
||||||
|
@ -12844,7 +12844,10 @@ restart_grand:
|
||||||
if ((cstat&4) > 0) xoff = -xoff;
|
if ((cstat&4) > 0) xoff = -xoff;
|
||||||
if ((cstat&8) > 0) yoff = -yoff;
|
if ((cstat&8) > 0) yoff = -yoff;
|
||||||
|
|
||||||
ang = spr->ang;
|
// &2047: FIXME ? DNE_BUG_HERE
|
||||||
|
// DNE 1.3D lights camera action (1st level), spr->ang==2306
|
||||||
|
ang = spr->ang&2047;
|
||||||
|
|
||||||
cosang = sintable[(ang+512)&2047]; sinang = sintable[ang];
|
cosang = sintable[(ang+512)&2047]; sinang = sintable[ang];
|
||||||
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
||||||
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
||||||
|
|
Loading…
Reference in a new issue