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
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-04-04 14:47:18 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-04-04 16:43:12 +0300
commit5ce95df2c6f2b86d53795b9b24fdd8ba239597f9 (patch)
treed050639a819501855bfb00078ee602ca964ff2bf /intern
parenta63a31dd12ece94cef9cddd6ce609541ab431a97 (diff)
Cycles: Fix uninitialized memory access when comparing curve mapping nodes
The issue is coming from the fact that float3 is actually 16 bytes aligned data type and the "padding" was not initialized. This caused memcmp() to access non-initialized memory.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_util.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index 4d575330520..abdbb6be0fd 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -174,22 +174,19 @@ static inline void curvemapping_color_to_array(BL::CurveMapping& cumap,
if(rgb_curve) {
BL::CurveMap mapI = cumap.curves[3];
-
for(int i = 0; i < size; i++) {
- float t = min_x + (float)i/(float)(size-1) * range_x;
-
- data[i][0] = mapR.evaluate(mapI.evaluate(t));
- data[i][1] = mapG.evaluate(mapI.evaluate(t));
- data[i][2] = mapB.evaluate(mapI.evaluate(t));
+ const float t = min_x + (float)i/(float)(size-1) * range_x;
+ data[i] = make_float3(mapR.evaluate(mapI.evaluate(t)),
+ mapG.evaluate(mapI.evaluate(t)),
+ mapB.evaluate(mapI.evaluate(t)));
}
}
else {
for(int i = 0; i < size; i++) {
float t = min_x + (float)i/(float)(size-1) * range_x;
-
- data[i][0] = mapR.evaluate(t);
- data[i][1] = mapG.evaluate(t);
- data[i][2] = mapB.evaluate(t);
+ data[i] = make_float3(mapR.evaluate(t),
+ mapG.evaluate(t),
+ mapB.evaluate(t));
}
}
}