star-3d

Surface structuring for efficient 3D geometric queries
git clone git://git.meso-star.fr/star-3d.git
Log | Files | Refs | README | LICENSE

commit 6b75d0ee9f39bd9843657b2f8f3878f042a9fc80
parent 13cf95fb4dd9e82646f64db18b978fbc85d3d262
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 18 May 2016 15:22:01 +0200

Fix an possible invalid memory read in s3d_scene_trace_rays

An invalid memory read occurred if no rays_data was submited while the
sizeof_ray_data was not null.

Diffstat:
Msrc/s3d_scene.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/s3d_scene.c b/src/s3d_scene.c @@ -942,7 +942,7 @@ s3d_scene_trace_rays org_step = mask & S3D_RAYS_SINGLE_ORIGIN ? 0 : 3; dir_step = mask & S3D_RAYS_SINGLE_DIRECTION ? 0 : 3; range_step = mask & S3D_RAYS_SINGLE_RANGE ? 0 : 2; - data_step = mask & S3D_RAYS_SINGLE_DATA ? 0 : sizeof_ray_data; + data_step = (mask & S3D_RAYS_SINGLE_DATA) || !rays_data ? 0 : sizeof_ray_data; iorg = idir = irange = idata = 0; FOR_EACH(iray, 0, nrays) {