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>
This commit is contained in:
Robert Bragg 2011-12-30 01:08:10 +00:00
parent 390bb69fba
commit 04a71afab5

View File

@ -1484,8 +1484,8 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
memcpy (uniforms_state->override_values, memcpy (uniforms_state->override_values,
old_values, old_values,
sizeof (CoglBoxedValue) * override_index); sizeof (CoglBoxedValue) * override_index);
memcpy (uniforms_state->override_values, memcpy (uniforms_state->override_values + override_index + 1,
old_values + override_index + 1, old_values + override_index,
sizeof (CoglBoxedValue) * (old_size - override_index)); sizeof (CoglBoxedValue) * (old_size - override_index));
g_free (old_values); g_free (old_values);