From 673ab1b94406ed5885ca2e74aa23cf91c581c3f5 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 25 Nov 2024 17:12:08 -0800 Subject: [PATCH] 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. --- src/sysprof/sysprof-normalized-series.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sysprof/sysprof-normalized-series.c b/src/sysprof/sysprof-normalized-series.c index d5240b68..9ba633a3 100644 --- a/src/sysprof/sysprof-normalized-series.c +++ b/src/sysprof/sysprof-normalized-series.c @@ -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);