Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-07-11 18:58:42 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-07-11 18:59:46 +0300
commitea32a0380148b3261679eded2149ebac7e3a15ef (patch)
tree5c1c7c34b9db3f37e58d651688302df78e8f79ee /intern/cycles/kernel/bvh/qbvh_shadow_all.h
parent8bc6f8bf20ab13abd232ba12f77eb904dfe95d79 (diff)
Fix T48824: Crash when having too many ray-to-volume intersections
Code might have writing past the array boundaries.
Diffstat (limited to 'intern/cycles/kernel/bvh/qbvh_shadow_all.h')
-rw-r--r--intern/cycles/kernel/bvh/qbvh_shadow_all.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/intern/cycles/kernel/bvh/qbvh_shadow_all.h b/intern/cycles/kernel/bvh/qbvh_shadow_all.h
index 3a728b388eb..34753ff067d 100644
--- a/intern/cycles/kernel/bvh/qbvh_shadow_all.h
+++ b/intern/cycles/kernel/bvh/qbvh_shadow_all.h
@@ -337,6 +337,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
/* Shadow ray early termination. */
if(hit) {
+ /* Update number of hits now, so we do proper check on max bounces. */
+ (*num_hits)++;
+
/* detect if this surface has a shader with transparent shadows */
/* todo: optimize so primitive visibility flag indicates if
@@ -367,13 +370,11 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
return true;
}
- /* move on to next entry in intersections array */
- isect_array++;
- (*num_hits)++;
#if BVH_FEATURE(BVH_INSTANCING)
num_hits_in_instance++;
#endif
-
+ /* Move on to next entry in intersections array */
+ isect_array++;
isect_array->t = isect_t;
}