mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-23 20:42:30 +00:00
Fix crash caused by too many surfaces in skin
This commit is contained in:
parent
61dd609aee
commit
27ddba9c2e
2 changed files with 10 additions and 0 deletions
|
@ -1602,6 +1602,11 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
||||||
// parse the shader name
|
// parse the shader name
|
||||||
token = CommaParse( &text_p );
|
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 );
|
surf = skin->surfaces[ skin->numSurfaces ] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
|
||||||
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
|
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
|
||||||
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
|
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
|
||||||
|
|
|
@ -3284,6 +3284,11 @@ qhandle_t RE_RegisterSkin( const char *name ) {
|
||||||
// parse the shader name
|
// parse the shader name
|
||||||
token = CommaParse( &text_p );
|
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 );
|
surf = skin->surfaces[ skin->numSurfaces ] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
|
||||||
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
|
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
|
||||||
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
|
surf->shader = R_FindShader( token, LIGHTMAP_NONE, qtrue );
|
||||||
|
|
Loading…
Reference in a new issue