From 83c082299048305d90b7a4453aafe0144682903c Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 30 Jun 2023 16:29:24 -0700 Subject: [PATCH] libsysprof-gtk: skip out of bounds data --- src/libsysprof-gtk/sysprof-column-layer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libsysprof-gtk/sysprof-column-layer.c b/src/libsysprof-gtk/sysprof-column-layer.c index 99d9f608..b13955d2 100644 --- a/src/libsysprof-gtk/sysprof-column-layer.c +++ b/src/libsysprof-gtk/sysprof-column-layer.c @@ -91,14 +91,18 @@ sysprof_column_layer_snapshot (GtkWidget *widget, for (guint i = 0; i < n_values; i++) { - int line_height = ceilf (y_values[i] * height); + if (x_values[i] < .0) + continue; + + if (x_values[i] > 1.) + break; gtk_snapshot_append_color (snapshot, color, &GRAPHENE_RECT_INIT (x_values[i] * width, 0, 1, - line_height)); + ceilf (y_values[i] * height))); } gtk_snapshot_restore (snapshot);