mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
value: Fix segfault comparing empty GValueArrays
Adding a test
This commit is contained in:
parent
0566b0528a
commit
88f0312624
2 changed files with 11 additions and 2 deletions
|
@ -1206,11 +1206,11 @@ gst_value_compare_g_value_array (const GValue * value1, const GValue * value2)
|
||||||
guint i;
|
guint i;
|
||||||
GValueArray *array1 = value1->data[0].v_pointer;
|
GValueArray *array1 = value1->data[0].v_pointer;
|
||||||
GValueArray *array2 = value2->data[0].v_pointer;
|
GValueArray *array2 = value2->data[0].v_pointer;
|
||||||
guint len = array1->n_values;
|
guint len = array1 ? array1->n_values : 0;
|
||||||
GValue *v1;
|
GValue *v1;
|
||||||
GValue *v2;
|
GValue *v2;
|
||||||
|
|
||||||
if (len != array2->n_values)
|
if (len != (array2 ? array2->n_values : 0))
|
||||||
return GST_VALUE_UNORDERED;
|
return GST_VALUE_UNORDERED;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
|
|
|
@ -1020,6 +1020,15 @@ GST_START_TEST (test_value_compare)
|
||||||
g_value_unset (&value2);
|
g_value_unset (&value2);
|
||||||
g_value_unset (&tmp);
|
g_value_unset (&tmp);
|
||||||
|
|
||||||
|
g_value_init (&value1, G_TYPE_VALUE_ARRAY);
|
||||||
|
g_value_init (&value2, G_TYPE_VALUE_ARRAY);
|
||||||
|
|
||||||
|
fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL,
|
||||||
|
"Empty Value arrays aren't equals when they should");
|
||||||
|
|
||||||
|
g_value_unset (&value1);
|
||||||
|
g_value_unset (&value2);
|
||||||
|
|
||||||
g_value_init (&value1, GST_TYPE_BITMASK);
|
g_value_init (&value1, GST_TYPE_BITMASK);
|
||||||
gst_value_set_bitmask (&value1, 0x123);
|
gst_value_set_bitmask (&value1, 0x123);
|
||||||
g_value_init (&value2, GST_TYPE_BITMASK);
|
g_value_init (&value2, GST_TYPE_BITMASK);
|
||||||
|
|
Loading…
Reference in a new issue