From 2f2c8e88be9db0fed4bdea35c32b891a95b5395c Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Mon, 28 Mar 2022 14:13:49 -0700 Subject: [PATCH] patch.c: add sanity check for patches that have subdivisions set to 0 --- tools/vmap/patch.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/vmap/patch.c b/tools/vmap/patch.c index 5f7b6e8..7ed09f1 100644 --- a/tools/vmap/patch.c +++ b/tools/vmap/patch.c @@ -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 ) {