From c2ad42b303187b0b79ce2a2922b836f9835a3dee Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 1 Mar 2010 03:04:57 +0000 Subject: [PATCH] Fix crash when calling rotatesprite from CON with invalid coordinates git-svn-id: https://svn.eduke32.com/eduke32@1600 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gameexec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 539777b3b..5c7b57fad 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2367,6 +2367,13 @@ nullquote: int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++); if (tw == CON_ROTATESPRITE && !(orientation & 256)) {x<<=16; y<<=16;} + + if (x < (-160)<<16 || x >= (480<<16) || y < (-100)<<16 || y >= (300<<16)) + { + OSD_Printf(CON_ERROR "invalid coordinates: %d, %d\n",g_errorLineNum, keyw[g_tw], x, y); + continue; + } + rotatesprite(x,y,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2); continue; }