mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
gvariant-serialiser: Add an assertion to help the static analyser
scan-build thinks that `gvs_variable_sized_array_is_normal()` can do a `NULL` pointer dereference on `value.data` when `value.size == 0`. This isn’t possible, because `offsets.length == 0` always when `value.size == 0`, but that’s a bit of a complex relationship which the static analyser can’t work out. Give it some help by adding an assertion. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #1767
This commit is contained in:
parent
3e68debb13
commit
62b5c738e7
@ -904,6 +904,8 @@ gvs_variable_sized_array_is_normal (GVariantSerialised value)
|
||||
if (value.size != 0 && offsets.length == 0)
|
||||
return FALSE;
|
||||
|
||||
g_assert (value.size != 0 || offsets.length == 0);
|
||||
|
||||
child.type_info = g_variant_type_info_element (value.type_info);
|
||||
g_variant_type_info_query (child.type_info, &alignment, NULL);
|
||||
child.depth = value.depth + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user