Control: tags -1 patch

Hi,

On 23/01/17 15:29, James Cowgill wrote:
> On 23/01/17 12:39, Jaromír Mikeš wrote:
>> 2017-01-22 1:11 GMT+01:00 James Cowgill <jcowg...@debian.org>:
>>     On 21/01/17 14:18, Christian Grigis wrote:
>>     [...]
>>     > The gdb backtrace gives:
>>     >
>>     > (gdb) run
>>     > Starting program: /home/glove/tmp/gwc-testing/gwc-0.21.19~dfsg0/gwc
>>     > [Thread debugging using libthread_db enabled]
>>     > Using host libthread_db library 
>> "/lib/x86_64-linux-gnu/libthread_db.so.1".
>>     > Current stack limit: 8388608 bytes
>>     >
>>     > Program received signal SIGSEGV, Segmentation fault.
>>     > 0x00007ffff6e047f9 in g_type_is_a () from 
>> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
>>     > (gdb) bt
>>     > #0  0x00007ffff6e047f9 in g_type_is_a () from 
>> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
>>     > #1  0x00007ffff7519084 in gtk_type_new () from 
>> /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
>>     > #2  0x000055555557223c in led_bar_new (segments=20, orientation=0) at 
>> gtkledbar.c:82
>>
>>     The problem is here. led_bar_get_type returns an unsigned int, but
>>     gtk_type_new expects a "GtkType" which is an integer with the same size
>>     as a pointer. This code is going to need porting to work on 64-bit
>>     arches.
>>
>> James I guess as it wouldn't be trivial to fix it by patch and we need
>> to this issue must be fixed upstream.
>> Am I right?
> 
> It's definitely an upstream issue, but I fear that by just pushing it
> upstream the package will be kicked out of stretch. It's hard to say how
> much work it would be until someone tries to fix it - it could be just
> this one function that's broken, or it could be many. You can probably
> catch a lot of these by enabling -Wconversion.

Looks like there weren't many instances of this particular bug (loads of
warnings to sieve through though). This patch should fix it.

James
Description: Fix pointer truncation issues in 2 _get_type functions
 On 64-bit architectures the pointers returned by these functions were being
 truncated to 32-bits causing segfaults.
Author: James Cowgill <jcowg...@debian.org>
Bug-Debian: https://bugs.debian.org/852082
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/gtkgamma.c
+++ b/gtkgamma.c
@@ -202,10 +202,10 @@ static char *xpm[][27] =
     }
   };
 
-guint
+GtkType
 gtk_gamma_curve_get_type (void)
 {
-  static guint gamma_curve_type = 0;
+  static GtkType gamma_curve_type = 0;
 
   if (!gamma_curve_type)
     {
--- a/gtkgamma.h
+++ b/gtkgamma.h
@@ -68,7 +68,7 @@ struct _GtkGammaCurveClass
 };
 
 
-guint      gtk_gamma_curve_get_type (void);
+GtkType    gtk_gamma_curve_get_type (void);
 GtkWidget* gtk_gamma_curve_new      (void);
 
 
--- a/gtkledbar.c
+++ b/gtkledbar.c
@@ -28,10 +28,10 @@
 static void     led_bar_class_init        (LedBarClass *klass);
 static void     led_bar_init              (LedBar      *led_bar);
 
-guint
+GtkType
 led_bar_get_type ()
 {
-  static guint led_bar_type = 0;
+  static GtkType led_bar_type = 0;
 
   if (!led_bar_type)
     {
--- a/gtkledbar.h
+++ b/gtkledbar.h
@@ -57,7 +57,7 @@ struct _LedBarClass
   GtkVBoxClass   parent_class;
 };
 
-guint         led_bar_get_type            (void);
+GtkType       led_bar_get_type            (void);
 GtkWidget*    led_bar_new                 (gint       segments,
 					   gint       orientation);
 gint          led_bar_get_num_segments    (GtkWidget  *bar);

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to