commit 1e73722d4cee936b677eef817c8b5494b37a4f7a
parent 62fde212a179db1d3bb3f8b051da76e62131592c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 15 Dec 2020 11:46:43 +0100
Check facet/vertex index on normal/position getters
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/suvm_volume.h b/src/suvm_volume.h
@@ -129,7 +129,7 @@ volume_primitive_get_vertex_position
float pos[3])
{
const uint32_t* ids;
- ASSERT(vol && iprim < volume_get_primitives_count(vol) && pos);
+ ASSERT(vol && iprim < volume_get_primitives_count(vol) && pos && ivert < 4);
ids = darray_u32_cdata_get(&vol->indices) + iprim*4/*#vertex per tetra*/;
pos[0] = darray_float_cdata_get(&vol->positions)[ids[ivert]*3 + 0];
pos[1] = darray_float_cdata_get(&vol->positions)[ids[ivert]*3 + 1];
@@ -182,6 +182,7 @@ volume_primitive_get_facet_normal
float normal[3])
{
ASSERT(vol && iprim < volume_get_primitives_count(vol) && normal);
+ ASSERT(ifacet < 4);
if(!darray_float_size_get(&vol->normals)) {
volume_primitive_compute_facet_normal(vol, iprim, ifacet, normal);