summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/renderergl1/tr_image.c5
-rw-r--r--src/renderergl2/tr_image.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/renderergl1/tr_image.c b/src/renderergl1/tr_image.c
index 665038c9..e91df62f 100644
--- a/src/renderergl1/tr_image.c
+++ b/src/renderergl1/tr_image.c
@@ -1603,6 +1603,11 @@ qhandle_t RE_RegisterSkin( const char *name ) {
// parse the shader name
token = CommaParse( &text_p );
+ if ( skin->numSurfaces >= MD3_MAX_SURFACES ) {
+ ri.Printf( PRINT_WARNING, "WARNING: Ignoring surfaces in '%s', the max is %d surfaces!\n", name, MD3_MAX_SURFACES );
+ break;
+ }
+
surf = skin->surfaces[ skin->numSurfaces ] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
diff --git a/src/renderergl2/tr_image.c b/src/renderergl2/tr_image.c
index 6681cbd9..7f264983 100644
--- a/src/renderergl2/tr_image.c
+++ b/src/renderergl2/tr_image.c
@@ -3285,6 +3285,11 @@ qhandle_t RE_RegisterSkin( const char *name ) {
// parse the shader name
token = CommaParse( &text_p );
+ if ( skin->numSurfaces >= MD3_MAX_SURFACES ) {
+ ri.Printf( PRINT_WARNING, "WARNING: Ignoring surfaces in '%s', the max is %d surfaces!\n", name, MD3_MAX_SURFACES );
+ break;
+ }
+
surf = skin->surfaces[ skin->numSurfaces ] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );