[Bf-blender-cvs] [9bbb53e] blender-v2.74-release: Cycles: Avoid memcpy of intersecting memory

Sergey Sharybin noreply at git.blender.org
Tue Mar 24 15:59:39 CET 2015


Commit: 9bbb53ef688268124b3a5bf58c16111036c2b0a4
Author: Sergey Sharybin
Date:   Fri Mar 20 21:14:50 2015 +0500
Branches: blender-v2.74-release
https://developer.blender.org/rB9bbb53ef688268124b3a5bf58c16111036c2b0a4

Cycles: Avoid memcpy of intersecting memory

Could happen when assignment happens to self during sorting.

===================================================================

M	intern/cycles/bvh/bvh_params.h

===================================================================

diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h
index 99bfd94..af8d8ee 100644
--- a/intern/cycles/bvh/bvh_params.h
+++ b/intern/cycles/bvh/bvh_params.h
@@ -113,7 +113,9 @@ public:
 	__forceinline int prim_type() const { return type; }
 
 	BVHReference& operator=(const BVHReference &arg) {
-		memcpy(this, &arg, sizeof(BVHReference));
+		if(&arg != this) {
+			memcpy(this, &arg, sizeof(BVHReference));
+		}
 		return *this;
 	}




More information about the Bf-blender-cvs mailing list