From 385562d143939705415c88155045085f971378ef Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 25 Oct 2018 23:31:05 +0000 Subject: [PATCH] Fix bounds checks occurring after array access in tessectrap() and polymost_precache() with very minor cleanup of surrounding lines. git-svn-id: https://svn.eduke32.com/eduke32@7104 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/polymost.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index eb979180d..ae10449c6 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -7345,7 +7345,7 @@ static void tessectrap(const float *px, const float *py, const int32_t *point2, npoints = numpoints; z = 0; for (i=0; imdnum < 2) return; - int j = (models[mid]->mdnum == 3) ? ((md3model_t *)models[mid])->head.numsurfs : 0; + int const surfaces = (models[mid]->mdnum == 3) ? ((md3model_t *)models[mid])->head.numsurfs : 0; - for (bssize_t i = 0; i <= j; i++) mdloadskin((md2model_t *)models[mid], 0, dapalnum, i); + for (int i = 0; i <= surfaces; i++) + mdloadskin((md2model_t *)models[mid], 0, dapalnum, i); } #else /* if !defined USE_OPENGL */