From cb6472b4ced79f6cd093756c6483699761cf674d Mon Sep 17 00:00:00 2001 From: eihrul Date: Tue, 9 Dec 2014 23:08:33 +0000 Subject: [PATCH] more miscellaneous fixes from graphitemaster git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12109 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 9 ++++++++- cl_video.c | 2 ++ common.c | 2 +- gl_rsurf.c | 10 +++++----- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index 460ef270..2828515f 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -276,7 +276,7 @@ static void CL_ParseStartSoundPacket(int largesoundindex) MSG_ReadVector(&cl_message, pos, cls.protocol); - if (sound_num >= MAX_SOUNDS) + if (sound_num < 0 || sound_num >= MAX_SOUNDS) { Con_Printf("CL_ParseStartSoundPacket: sound_num (%i) >= MAX_SOUNDS (%i)\n", sound_num, MAX_SOUNDS); return; @@ -2305,6 +2305,13 @@ static void CL_ParseStaticSound (int large) sound_num = (unsigned short) MSG_ReadShort(&cl_message); else sound_num = MSG_ReadByte(&cl_message); + + if (sound_num < 0 || sound_num >= MAX_SOUNDS) + { + Con_Printf("CL_ParseStaticSound: sound_num(%i) >= MAX_SOUNDS (%i)\n", sound_num, MAX_SOUNDS); + return; + } + vol = MSG_ReadByte(&cl_message); atten = MSG_ReadByte(&cl_message); diff --git a/cl_video.c b/cl_video.c index f23dc928..db2302d6 100644 --- a/cl_video.c +++ b/cl_video.c @@ -568,7 +568,9 @@ void CL_DrawVideo(void) #ifndef USE_GLES2 // disable video-only stipple if (qglPolygonStipple && !scr_stipple.integer && cl_video_stipple.integer) + { qglDisable(GL_POLYGON_STIPPLE);CHECKGLERROR + } #endif // VorteX: draw subtitle_text diff --git a/common.c b/common.c index b36dae52..667f99c6 100644 --- a/common.c +++ b/common.c @@ -1620,7 +1620,7 @@ void COM_Init_Commands (void) { // arg contains whitespace, store quotes around it com_cmdline[n++] = '\"'; - while ((n < ((int)sizeof(com_cmdline) - 1)) && com_argv[j][i]) + while ((n < ((int)sizeof(com_cmdline) - 2)) && com_argv[j][i]) com_cmdline[n++] = com_argv[j][i++]; com_cmdline[n++] = '\"'; } diff --git a/gl_rsurf.c b/gl_rsurf.c index 38a92892..d589cfcb 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -775,13 +775,13 @@ static void R_Q1BSP_RecursiveGetLightInfo_BSP(r_q1bsp_getlightinfo_t *info, qboo // recurse front side first because the svbsp building prefers it if (info->relativelightorigin[plane->type] >= plane->dist) { - if (nodestackpos < GETLIGHTINFO_MAXNODESTACK) + if (nodestackpos < GETLIGHTINFO_MAXNODESTACK-1) nodestack[nodestackpos++] = node->children[0]; nodestack[nodestackpos++] = node->children[1]; } else { - if (nodestackpos < GETLIGHTINFO_MAXNODESTACK) + if (nodestackpos < GETLIGHTINFO_MAXNODESTACK-1) nodestack[nodestackpos++] = node->children[1]; nodestack[nodestackpos++] = node->children[0]; } @@ -805,13 +805,13 @@ static void R_Q1BSP_RecursiveGetLightInfo_BSP(r_q1bsp_getlightinfo_t *info, qboo // recurse front side first because the svbsp building prefers it if (PlaneDist(info->relativelightorigin, plane) >= 0) { - if (nodestackpos < GETLIGHTINFO_MAXNODESTACK) + if (nodestackpos < GETLIGHTINFO_MAXNODESTACK-1) nodestack[nodestackpos++] = node->children[0]; nodestack[nodestackpos++] = node->children[1]; } else { - if (nodestackpos < GETLIGHTINFO_MAXNODESTACK) + if (nodestackpos < GETLIGHTINFO_MAXNODESTACK-1) nodestack[nodestackpos++] = node->children[1]; nodestack[nodestackpos++] = node->children[0]; } @@ -1084,7 +1084,7 @@ static void R_Q1BSP_RecursiveGetLightInfo_BIH(r_q1bsp_getlightinfo_t *info, cons #endif if (info->lightmins[axis] <= node->backmax) { - if (info->lightmaxs[axis] >= node->frontmin && nodestackpos < GETLIGHTINFO_MAXNODESTACK) + if (info->lightmaxs[axis] >= node->frontmin && nodestackpos < GETLIGHTINFO_MAXNODESTACK-1) nodestack[nodestackpos++] = node->front; nodestack[nodestackpos++] = node->back; continue; -- 2.39.2