patch.c: add sanity check for patches that have subdivisions set to 0

This commit is contained in:
Marco Cawthorne 2022-03-28 14:13:49 -07:00
parent 028f1ae2a0
commit 2f2c8e88be
Signed by: eukara
GPG key ID: C196CD8BA993248A

View file

@ -285,6 +285,12 @@ void ParsePatch( qboolean onlyLights, qboolean fixedtess, qboolean extended ){
m.height = info[1];
m.subdiv_x = fixedtess?info[2]:-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] ) );
if ( m.width < 0 || m.width > MAX_PATCH_SIZE || m.height < 0 || m.height > MAX_PATCH_SIZE ) {