diff options
author | Zack Middleton <zturtleman@gmail.com> | 2013-06-18 17:02:47 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:32 +0100 |
commit | 2b6fe326bef2f881a453edfc0909a1af104ffd9d (patch) | |
tree | 1f4adf62dab791da9475c839dab921497786471e /src/renderergl2/tr_model_iqm.c | |
parent | d86e37ffe4011a77eacb38eb58e597afe151792e (diff) |
Only allow model meshes to have SHADER_MAX_VERTEXES - 1 vertexes
The last index is used to check for buffer overflows. See RB_CheckOverflow and RB_EndSurface.
Diffstat (limited to 'src/renderergl2/tr_model_iqm.c')
-rw-r--r-- | src/renderergl2/tr_model_iqm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/renderergl2/tr_model_iqm.c b/src/renderergl2/tr_model_iqm.c index e949fb10..b76c30b4 100644 --- a/src/renderergl2/tr_model_iqm.c +++ b/src/renderergl2/tr_model_iqm.c @@ -318,17 +318,17 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na } // check ioq3 limits - if ( mesh->num_vertexes > SHADER_MAX_VERTEXES ) + if ( mesh->num_vertexes >= SHADER_MAX_VERTEXES ) { ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on %s (%i).\n", - mod_name, SHADER_MAX_VERTEXES, meshName[0] ? meshName : "a surface", + mod_name, SHADER_MAX_VERTEXES - 1, meshName[0] ? meshName : "a surface", mesh->num_vertexes ); return qfalse; } - if ( mesh->num_triangles*3 > SHADER_MAX_INDEXES ) + if ( mesh->num_triangles*3 >= SHADER_MAX_INDEXES ) { ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on %s (%i).\n", - mod_name, SHADER_MAX_INDEXES / 3, meshName[0] ? meshName : "a surface", + mod_name, ( SHADER_MAX_INDEXES / 3 ) - 1, meshName[0] ? meshName : "a surface", mesh->num_triangles ); return qfalse; } |