[cogl] pipeline: fix realloc of uniform overrides array
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] pipeline: fix realloc of uniform overrides array
- Date: Wed, 4 Jan 2012 19:34:28 +0000 (UTC)
commit 04a71afab5adf546a32e9d8705fb40aa0e39c724
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.
Reviewed-by: Neil Roberts <neil linux intel com>
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]