diff options
author | Zack Middleton <zturtleman@gmail.com> | 2013-09-04 20:36:45 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:34 +0100 |
commit | 57ba5d4419af6c57be928ca57da090622411215f (patch) | |
tree | 75df570a5f8827cb6977fd3ca6ba1478c4c4e41e /src/renderergl1/tr_image.c | |
parent | cc05b29d64d1452085daa74f47c49675ffb89e54 (diff) |
Fix crash caused by too many surfaces in skin
Diffstat (limited to 'src/renderergl1/tr_image.c')
-rw-r--r-- | src/renderergl1/tr_image.c | 5 |
1 files changed, 5 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 ); |