From 18d95adb01337e18d49e7c40355dd64df556b67d Mon Sep 17 00:00:00 2001 From: pr-hung Date: Wed, 11 Mar 2026 23:29:37 +0800 Subject: [PATCH] Fix potential vulnerability in cloned code (xs/src/admesh/normals.c) --- --- a/src/admesh/normals.c +++ b/src/admesh/normals.c @@ -142,7 +142,8 @@ stl_fix_normal_directions(stl_file *stl) { } } /* If this edge of the facet is connected: */ - if(stl->neighbors_start[facet_num].neighbor[j] != -1) { + if(stl->neighbors_start[facet_num].neighbor[j] != -1 && + stl->neighbors_start[facet_num].neighbor[j] < stl->stats.number_of_facets*sizeof(char)) { /* If we haven't fixed this facet yet, add it to the list: */ if(norm_sw[stl->neighbors_start[facet_num].neighbor[j]] != 1) { /* Add node to beginning of list. */