sysprof: ensure we add range to the bitset

We need to still call add, but we only want to do it when the added values
are necessary. Otherwise we can get UB.
This commit is contained in:
Christian Hergert
2024-11-25 17:12:08 -08:00
parent 2ea689c299
commit 673ab1b944

View File

@ -174,7 +174,12 @@ sysprof_normalized_series_items_changed (SysprofSeries *series,
g_assert (G_IS_LIST_MODEL (model));
if (removed > 0 || added > 0)
egg_bitset_splice (self->missing, position, removed, added);
{
egg_bitset_splice (self->missing, position, removed, added);
if (added > 0)
egg_bitset_add_range (self->missing, position, added);
}
if (removed > 0)
g_array_remove_range (self->values, position, removed);