]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
more miscellaneous fixes from graphitemaster
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 9 Dec 2014 23:08:33 +0000 (23:08 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 9 Dec 2014 23:08:33 +0000 (23:08 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12109 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
cl_video.c
common.c
gl_rsurf.c

index 460ef2701b7f2b6fdcf9038c275e66865fa4a6d1..2828515f9da56c7f5ab0b9dd547b035c72fabd48 100644 (file)
@@ -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);
 
index f23dc928edb523073d7e3903eabef473c76f749c..db2302d6e54214328489ebed370022a71645cfb4 100644 (file)
@@ -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
index b36dae525d324d96e50e61ca9254fefc0b6a8ae1..667f99c6bbe887ca940a568f632663c81dcbf198 100644 (file)
--- 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++] = '\"';
                }
index 38a928922b8e2909b710a242086be938472f4ece..d589cfcb1b726f3f83304063c83b4267411b8628 100644 (file)
@@ -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;