]> git.pld-linux.org Git - packages/ekg2.git/commitdiff
- fix segfault in ekg2 on x86_64
authorpawelz <pawelz@pld-linux.org>
Fri, 22 Jan 2010 00:41:28 +0000 (00:41 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    ekg2-python-x8664-segfault.patch -> 1.1

ekg2-python-x8664-segfault.patch [new file with mode: 0644]

diff --git a/ekg2-python-x8664-segfault.patch b/ekg2-python-x8664-segfault.patch
new file mode 100644 (file)
index 0000000..5a64963
--- /dev/null
@@ -0,0 +1,38 @@
+git://github.com/pawelz/ekg2.git branch master:
+
+commit a31760d809e3e464e5e26dc42de97a5e1c9ec53f
+Author: PaweÅ‚ Zuzelski <pawelz@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];
This page took 0.805825 seconds and 4 git commands to generate.