Hello community,

here is the log from the commit of package gkrellm for openSUSE:Factory checked 
in at 2015-05-07 08:29:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/gkrellm (Old)
 and      /work/SRC/openSUSE:Factory/.gkrellm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "gkrellm"

Changes:
--------
--- /work/SRC/openSUSE:Factory/gkrellm/gkrellm.changes  2014-06-10 
14:38:41.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.gkrellm.new/gkrellm.changes     2015-05-07 
08:29:30.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Mar 27 14:04:16 UTC 2015 - [email protected]
+
+- add gkrellm-2.3.5-fix-diskio-corruption.patch to fix corruption
+  of chart labels (actually work around it)
+
+-------------------------------------------------------------------

New:
----
  gkrellm-2.3.5-fix-diskio-corruption.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ gkrellm.spec ++++++
--- /var/tmp/diff_new_pack.bgcvZK/_old  2015-05-07 08:29:31.000000000 +0200
+++ /var/tmp/diff_new_pack.bgcvZK/_new  2015-05-07 08:29:31.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package gkrellm
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -38,6 +38,8 @@
 Patch1:         %{name}-lib64-plugins-dir.patch
 # PATCH-FIX-OPENSUSE gkrellm-2.3.5-fix-sdX-sort-order.patch 
[email protected] -- fix sort order for scsi-style disks sda,sdb,sdc,...
 Patch2:         %{name}-2.3.5-fix-sdX-sort-order.patch
+# PATCH-FIX-OPENSUSE gkrellm-2.3.5-fix-diskio-corruption.patch 
[email protected] -- fix corruption in chart labels
+Patch3:         %{name}-2.3.5-fix-diskio-corruption.patch
 BuildRequires:  gtk2-devel
 BuildRequires:  libsensors4-devel
 %if 0%{?suse_version} > 1220
@@ -104,6 +106,7 @@
 %patch0
 %patch1
 %patch2 -p1
+%patch3 -p1
 
 %build
 cd src


++++++ gkrellm-2.3.5-fix-diskio-corruption.patch ++++++
Author: Stefan Seyfried
Subject: fix corruption of chart labels

I was seeing corruption in my r/w label in the disk chart.
Investigation showed, that this was caused by invalid UTF8 being passed to 
pango_layout_set_text().
In the relevant places, I now check if the string is valid UTF8 before passing 
it (or a NULL pointer)
to pango_layout_set_text().
Also, fix a possible buffer overrun resulting from 
gkrellm_format_size_abbrev(), because it was
misusing snprintf return code (but this was probably not the reason of the 
invalid UTF8, as it did
not help that problem :-)
I'm guessing that the original problem is a 32bit overflow in the disk 
statistics gathering, I
suspect that I/O speeds of over 2GB/sec result in huge negative numbers.
Anyway, the additional check for valid UTF8 makes the corruption go away and 
that's better
than not fixing it at all.

diff --git a/src/utils.c b/src/utils.c
index c6a2773..1ed7382 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -276,15 +276,24 @@ gkrellm_format_size_abbrev(gchar *buf, size_t buflen, 
gfloat size,
        {
        gfloat  abs_size;
        gint    i;
+       int ret;
 
        abs_size = (size < 0.0) ? -size : size;
 
        for (i = 0; i < tbl_size - 1; ++i)
                if (abs_size < tbl[i].limit)
                        break;
-       return snprintf(buf, buflen, tbl[i].format, size / tbl[i].divisor);
+       ret = snprintf(buf, buflen, tbl[i].format, size / tbl[i].divisor);
+       if (ret > buflen) {
+               fprintf(stderr, "%s:%d ret>buflen %d > %d\n", __func__, 
__LINE__, ret, buflen);
+               return buflen;
+       }
+       if (ret < 0) {
+               fprintf(stderr, "%s:%d ret < 0 %d < %d\n", __func__, __LINE__, 
ret, 0);
+               return 0;
+       }
+       return ret;
        }
-
 
   /* Next three calls return string extent info.  Width extents are logical
   |  so that spaces will be counted while height extent is ink so that gkrellm
@@ -366,7 +375,8 @@ gkrellm_text_extents(PangoFontDescription *font_desc, gchar 
*text,
        else
                {
                utf8 = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
-               pango_layout_set_text(layout, utf8, len);
+               if (utf8)
+                       pango_layout_set_text(layout, utf8, len);
                g_free(utf8);
                }
        iter = pango_layout_get_iter(layout);
@@ -456,7 +466,8 @@ gkrellm_gdk_draw_text(GdkDrawable *drawable, 
PangoFontDescription *font_desc,
 
        layout = gtk_widget_create_pango_layout(gkrellm_get_top_window(), NULL);
        pango_layout_set_font_description(layout, font_desc);
-       pango_layout_set_text(layout, string, len);
+       if (g_utf8_validate(string, -1, NULL))
+               pango_layout_set_text(layout, string, len);
        gdk_draw_layout(drawable, gc, x, y, layout);
        g_object_unref(layout);
        }




Reply via email to