mirror of
https://github.com/brl/mutter.git
synced 2024-12-01 12:20:47 -05:00
cogl-matrix-stack: fix use after free in matrix stack.
If the matrix was reallocated we would use values from the stack for the matrix parameters. This fixes that and also uses the function instead of out of lining the same code. https://bugzilla.gnome.org/show_bug.cgi?id=671985 Reviewed-by: Robert Bragg <robert@linux.intel.com> Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
parent
46b1727705
commit
d42efa3741
@ -110,8 +110,11 @@ _cogl_matrix_stack_top_mutable (CoglMatrixStack *stack,
|
|||||||
state->push_count -= 1;
|
state->push_count -= 1;
|
||||||
|
|
||||||
g_array_set_size (stack->stack, stack->stack->len + 1);
|
g_array_set_size (stack->stack, stack->stack->len + 1);
|
||||||
new_top = &g_array_index (stack->stack, CoglMatrixState,
|
/* if g_array_set_size reallocs we need to get state
|
||||||
stack->stack->len - 1);
|
* pointer again */
|
||||||
|
state = &g_array_index (stack->stack, CoglMatrixState,
|
||||||
|
stack->stack->len - 2);
|
||||||
|
new_top = _cogl_matrix_stack_top(stack);
|
||||||
_cogl_matrix_state_init (new_top);
|
_cogl_matrix_state_init (new_top);
|
||||||
|
|
||||||
if (initialize)
|
if (initialize)
|
||||||
|
Loading…
Reference in New Issue
Block a user