[PATCH] fix crashing on amd64



we'd experienced application crash on x86_64 for quite some time. it's
quite reproductable with 1.11x branch. perl loops while trying to segfaulting.

Patch from Rafael Garcia-Suarez <rgarciasuarez mandriva com> traced it
and fixed it:

On x86_64, the conversions from ptr to int and from int to ptr will
loose the highest bits of the pointer, leading to memory access
violations. Use the safer macros that perl provides instead.

--- GObject.xs  2006/01/11 14:24:47     1.1
+++ GObject.xs  2006/01/11 15:01:06
@@ -491,9 +491,9 @@
  * Manipulate a pointer to indicate that an SV is undead.
  * Relies on SV pointers being word-aligned.
  */
-#define IS_UNDEAD(x) (GPOINTER_TO_UINT(x) & 1)
-#define MAKE_UNDEAD(x) GUINT_TO_POINTER(GPOINTER_TO_UINT(x) | 1)
-#define REVIVE_UNDEAD(x) GUINT_TO_POINTER(GPOINTER_TO_UINT(x) & ~1)
+#define IS_UNDEAD(x) (PTR2UV(x) & 1)
+#define MAKE_UNDEAD(x) INT2PTR(UV,PTR2UV(x) | 1)
+#define REVIVE_UNDEAD(x) INT2PTR(UV,PTR2UV(x) & ~1)
 
 /*
  * this function is called whenever the gobject gets destroyed. this only


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]