Fix potential oob access when flipping the floor [F] in 2D mode.

git-svn-id: https://svn.eduke32.com/eduke32@3824 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-05-30 09:13:34 +00:00
parent 560f88b022
commit 4457a5fbca

View file

@ -4775,12 +4775,14 @@ static void toggle_cf_flipping(int32_t sectnum, int32_t floorp)
static const int16_t orient[8] = { 360, -360, -180, 180, -270, 270, 90, -90 };
uint16_t *stat = &SECTORFLD(sectnum,stat, floorp);
const int32_t search = floorp ? SEARCH_FLOOR : SEARCH_CEILING;
uint16_t *const stat = &SECTORFLD(sectnum,stat, floorp);
int32_t i = *stat;
i = (i&0x4)+((i>>4)&3);
i = eitherSHIFT ? prev3[i] : next3[i];
message("Sector %d %s flip %d deg%s", searchsector, typestr[searchstat],
message("Sector %d %s flip %d deg%s", sectnum, typestr[search],
klabs(orient[i])%360, orient[i] < 0 ? " mirrored":"");
i = (i&0x4)+((i&3)<<4);
*stat &= ~0x34;