From fb7fb403e06bb523cfe8ae5cc1d6fe497176a6ef Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 23 Aug 2014 09:00:36 +0000 Subject: [PATCH] engine.c: prevent a 64-bit multiply in dosetaspect(). DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@4576 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 714c25471..5e83bee4e 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -7876,8 +7876,12 @@ static void dosetaspect(void) radarang2[i] = (int16_t)((radarang[k]+j)>>6); } - for (i=1; i<(int32_t)ARRAY_SIZE(distrecip); i++) - distrecip[i] = divscale20(xdimen,i); + { + EDUKE32_STATIC_ASSERT((uint64_t)MAXXDIM*(ARRAY_SIZE(distrecip)-1) <= INT32_MAX); + + for (i=1; i<(int32_t)ARRAY_SIZE(distrecip); i++) + distrecip[i] = (xdimen * i)>>20; + } nytooclose = xdimen*2100; nytoofar = 65536*16384-1048576;