shader-types: Check the size of the values

Emit a critical error if the user tries to send more data than
the static shader GValues can hold.

This fixes the random memory corruption you get when specifying
size > 4.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Richard Hughes 2010-06-16 16:19:48 +01:00 committed by Emmanuele Bassi
parent 2d99f77e3b
commit 2a354d9650

View File

@ -399,6 +399,7 @@ clutter_value_set_shader_float (GValue *value,
gint i;
g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value));
g_return_if_fail (size <= 4);
shader_float = value->data[0].v_pointer;
@ -428,6 +429,7 @@ clutter_value_set_shader_int (GValue *value,
gint i;
g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_INT (value));
g_return_if_fail (size <= 4);
shader_int = value->data[0].v_pointer;
@ -457,6 +459,7 @@ clutter_value_set_shader_matrix (GValue *value,
gint i;
g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value));
g_return_if_fail (size <= 4);
shader_matrix = value->data[0].v_pointer;