[cogl/fosdem-2012: 4/19] pipeline: fix realloc of uniform overrides array



commit 740c44c83de7a45917dc374becfc3ae976f3fded
Author: Robert Bragg <robert linux intel com>
Date:   Fri Dec 30 01:08:10 2011 +0000

    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.

 cogl/cogl-pipeline-state.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl-pipeline-state.c b/cogl/cogl-pipeline-state.c
index 3e010f2..4dd06f9 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]