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.
This commit is contained in:
parent
29f991cbf2
commit
11f131aa1f
1 changed files with 2 additions and 2 deletions
|
|
@ -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 ?
|
||||
|
|
|
|||
Loading…
Reference in a new issue