From 919a6654974f40c553ba30a4aba89e9d02251246 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 20 Mar 2015 21:14:50 +0500 Subject: Cycles: Avoid memcpy of intersecting memory Could happen when assignment happens to self during sorting. --- intern/cycles/bvh/bvh_params.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h index 99bfd9449da..af8d8eeb3ee 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; } -- cgit v1.2.3