[Bf-blender-cvs] [c6f55fb0db1] blender2.8: GPUUniformBuffer: Fix bad memcpy error catched by asan

Clément Foucault noreply at git.blender.org
Wed Aug 1 22:10:36 CEST 2018


Commit: c6f55fb0db126281309a2082abf2f480a4671dc5
Author: Clément Foucault
Date:   Wed Aug 1 18:02:57 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBc6f55fb0db126281309a2082abf2f480a4671dc5

GPUUniformBuffer: Fix bad memcpy error catched by asan

We need to copy the size of the gputype not the padded type.

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

M	source/blender/gpu/intern/gpu_uniformbuffer.c

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

diff --git a/source/blender/gpu/intern/gpu_uniformbuffer.c b/source/blender/gpu/intern/gpu_uniformbuffer.c
index 9b8441efd08..3f5706c1f7b 100644
--- a/source/blender/gpu/intern/gpu_uniformbuffer.c
+++ b/source/blender/gpu/intern/gpu_uniformbuffer.c
@@ -159,9 +159,8 @@ GPUUniformBuffer *GPU_uniformbuffer_dynamic_create(ListBase *inputs, char err_ou
 	float *offset = ubo->data;
 	for (LinkData *link = inputs->first; link; link = link->next) {
 		GPUInput *input = link->data;
-		const GPUType gputype = get_padded_gpu_type(link);
-		memcpy(offset, input->dynamicvec, gputype * sizeof(float));
-		offset += gputype;
+		memcpy(offset, input->dynamicvec, input->type * sizeof(float));
+		offset += get_padded_gpu_type(link);
 	}
 
 	/* Note since we may create the UBOs in the CPU in a different thread than the main drawing one,



More information about the Bf-blender-cvs mailing list