patch.c: add sanity check for patches that have subdivisions set to 0
This commit is contained in:
parent
028f1ae2a0
commit
2f2c8e88be
1 changed files with 6 additions and 0 deletions
|
@ -285,6 +285,12 @@ void ParsePatch( qboolean onlyLights, qboolean fixedtess, qboolean extended ){
|
||||||
m.height = info[1];
|
m.height = info[1];
|
||||||
m.subdiv_x = fixedtess?info[2]:-1;
|
m.subdiv_x = fixedtess?info[2]:-1;
|
||||||
m.subdiv_y = fixedtess?info[3]:-1;
|
m.subdiv_y = fixedtess?info[3]:-1;
|
||||||
|
|
||||||
|
if (m.subdiv_x == 0)
|
||||||
|
m.subdiv_x = -1;
|
||||||
|
if (m.subdiv_y == 0)
|
||||||
|
m.subdiv_y = -1;
|
||||||
|
|
||||||
m.verts = verts = safe_malloc( m.width * m.height * sizeof( m.verts[0] ) );
|
m.verts = verts = safe_malloc( m.width * m.height * sizeof( m.verts[0] ) );
|
||||||
|
|
||||||
if ( m.width < 0 || m.width > MAX_PATCH_SIZE || m.height < 0 || m.height > MAX_PATCH_SIZE ) {
|
if ( m.width < 0 || m.width > MAX_PATCH_SIZE || m.height < 0 || m.height > MAX_PATCH_SIZE ) {
|
||||||
|
|
Loading…
Reference in a new issue