SW: Fix OOB access when viewing a mirror

git-svn-id: https://svn.eduke32.com/eduke32@8299 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-11-26 08:24:23 +00:00 committed by Christoph Oelckers
parent 2fc49b3489
commit fd3ec56827

View file

@ -578,7 +578,7 @@ JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz)
{ {
for (cnt = MAXMIRRORS - 1; cnt >= 0; cnt--) for (cnt = MAXMIRRORS - 1; cnt >= 0; cnt--)
//if (TEST_GOTPIC(cnt + MIRRORLABEL) || TEST_GOTPIC(cnt + CAMSPRITE)) //if (TEST_GOTPIC(cnt + MIRRORLABEL) || TEST_GOTPIC(cnt + CAMSPRITE))
if (TEST_GOTPIC(cnt + MIRRORLABEL) || TEST_GOTPIC(mirror[cnt].campic)) if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic)))
{ {
bIsWallMirror = FALSE; bIsWallMirror = FALSE;
if (TEST_GOTPIC(cnt + MIRRORLABEL)) if (TEST_GOTPIC(cnt + MIRRORLABEL))
@ -587,7 +587,7 @@ JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz)
RESET_GOTPIC(cnt + MIRRORLABEL); RESET_GOTPIC(cnt + MIRRORLABEL);
} }
//else if (TEST_GOTPIC(cnt + CAMSPRITE)) //else if (TEST_GOTPIC(cnt + CAMSPRITE))
else if (TEST_GOTPIC(mirror[cnt].campic)) else if ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic))
{ {
//RESET_GOTPIC(cnt + CAMSPRITE); //RESET_GOTPIC(cnt + CAMSPRITE);
RESET_GOTPIC(mirror[cnt].campic); RESET_GOTPIC(mirror[cnt].campic);