From 11f131aa1f92e85704fdd6c158e19cf31d5fc2e7 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Fri, 13 Feb 2026 06:17:52 +0000 Subject: [PATCH] widgets: Use 64bit for HistogramEditor counts Resolves #13014 In GimpHistogramEditor, pixels and counts are stored as doubles. We previously converted them into 32bit integers when displaying the values to the user. As it is possible for the dimensions of an image to exceed the limit of a 32bit integer, this could lead to overflow and negative pixel counts. This patch switches our display code to use 64bit gsize casts for conversion to prevent this from happening. --- app/widgets/gimphistogrameditor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c index 2bc882716c..d8438af1d0 100644 --- a/app/widgets/gimphistogrameditor.c +++ b/app/widgets/gimphistogrameditor.c @@ -798,10 +798,10 @@ gimp_histogram_editor_info_update (GimpHistogramEditor *editor) view->end)); gtk_label_set_text (GTK_LABEL (editor->labels[LABEL_MEDIAN]), text); - g_snprintf (text, sizeof (text), "%d", (gint) pixels); + g_snprintf (text, sizeof (text), "%" G_GSIZE_FORMAT, (gsize) pixels); gtk_label_set_text (GTK_LABEL (editor->labels[LABEL_PIXELS]), text); - g_snprintf (text, sizeof (text), "%d", (gint) count); + g_snprintf (text, sizeof (text), "%" G_GSIZE_FORMAT, (gsize) count); gtk_label_set_text (GTK_LABEL (editor->labels[LABEL_COUNT]), text); g_snprintf (text, sizeof (text), "%.1f", (pixels > 0 ?