From 04a71afab5adf546a32e9d8705fb40aa0e39c724 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Fri, 30 Dec 2011 01:08:10 +0000 Subject: [PATCH] pipeline: fix realloc of uniform overrides array If we need to realloc the uniforms overrides array for a pipeline to insert a new override then we copy the old state into the new allocation for the entries surrounding the inserted entry. This patch fixes a mistake in how we copied the old entries that follow the inserted entry since we were actually copying to begining of the new allocation and potentially reading from beyond the extents of the old allocation. Reviewed-by: Neil Roberts --- cogl/cogl-pipeline-state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogl/cogl-pipeline-state.c b/cogl/cogl-pipeline-state.c index 3e010f2b3..4dd06f9cf 100644 --- a/cogl/cogl-pipeline-state.c +++ b/cogl/cogl-pipeline-state.c @@ -1484,8 +1484,8 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline, memcpy (uniforms_state->override_values, old_values, sizeof (CoglBoxedValue) * override_index); - memcpy (uniforms_state->override_values, - old_values + override_index + 1, + memcpy (uniforms_state->override_values + override_index + 1, + old_values + override_index, sizeof (CoglBoxedValue) * (old_size - override_index)); g_free (old_values);