packages: ekg2/ekg2-python-x8664-segfault.patch (NEW) - fix segfault in ekg...

pawelz pawelz at pld-linux.org
Fri Jan 22 01:41:33 CET 2010


Author: pawelz                       Date: Fri Jan 22 00:41:33 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- fix segfault in ekg2 on x86_64

---- Files affected:
packages/ekg2:
   ekg2-python-x8664-segfault.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/ekg2/ekg2-python-x8664-segfault.patch
diff -u /dev/null packages/ekg2/ekg2-python-x8664-segfault.patch:1.1
--- /dev/null	Fri Jan 22 01:41:33 2010
+++ packages/ekg2/ekg2-python-x8664-segfault.patch	Fri Jan 22 01:41:28 2010
@@ -0,0 +1,38 @@
+git://github.com/pawelz/ekg2.git branch master:
+
+commit a31760d809e3e464e5e26dc42de97a5e1c9ec53f
+Author: Paweł Zuzelski <pawelz at pld-linux.org>
+Date:   Fri Jan 22 01:17:47 2010 +0100
+
+    fixed conversion from long to PyObject
+    
+    The false assumption sizeof(long) == size(void*) exists where PyInt_FromLong
+    is used to represent a pointer. The safe Python call for this is
+    PyLong_FromVoidPtr. (On platforms where the above assumption *is* true a PyInt
+    is returned as before so there is no effective change.)
+    
+    This fixes segfault on x86_64 machines. The simplest way to reproduce segfault
+    is to load the following python script:
+    
+    import ekg
+    
+    def reply(session, uid, type, text, stime, ignore_level):
+        ekg.command("/msg "+uid+" "+text)
+    
+    ekg.handler_bind('protocol-message', reply)
+    
+    and receive any message.
+
+diff --git a/plugins/python/python.c b/plugins/python/python.c
+index 272ad4f..9a33049 100644
+--- a/plugins/python/python.c
++++ b/plugins/python/python.c
+@@ -222,7 +222,7 @@ int python_query(script_t *scr, script_query_t *scr_que, void **args)
+ 		PyObject *w = NULL;
+ 		switch ( scr_que->argv_type[i] ) {
+ 			case (QUERY_ARG_INT):
+-				w = PyInt_FromLong((long) *(int *) args[i] );
++				w = PyLong_FromVoidPtr( args[i] );
+ 				break;
+ 			case (QUERY_ARG_CHARP): {
+ 				char *tmp = *(char **) args[i];
================================================================


More information about the pld-cvs-commit mailing list