]> git.pld-linux.org Git - packages/ekg2.git/blob - ekg2-python-x8664-segfault.patch
- up to 20100126
[packages/ekg2.git] / ekg2-python-x8664-segfault.patch
1 git://github.com/pawelz/ekg2.git branch master:
2
3 commit a31760d809e3e464e5e26dc42de97a5e1c9ec53f
4 Author: PaweÅ‚ Zuzelski <pawelz@pld-linux.org>
5 Date:   Fri Jan 22 01:17:47 2010 +0100
6
7     fixed conversion from long to PyObject
8     
9     The false assumption sizeof(long) == size(void*) exists where PyInt_FromLong
10     is used to represent a pointer. The safe Python call for this is
11     PyLong_FromVoidPtr. (On platforms where the above assumption *is* true a PyInt
12     is returned as before so there is no effective change.)
13     
14     This fixes segfault on x86_64 machines. The simplest way to reproduce segfault
15     is to load the following python script:
16     
17     import ekg
18     
19     def reply(session, uid, type, text, stime, ignore_level):
20         ekg.command("/msg "+uid+" "+text)
21     
22     ekg.handler_bind('protocol-message', reply)
23     
24     and receive any message.
25
26 diff --git a/plugins/python/python.c b/plugins/python/python.c
27 index 272ad4f..9a33049 100644
28 --- a/plugins/python/python.c
29 +++ b/plugins/python/python.c
30 @@ -222,7 +222,7 @@ int python_query(script_t *scr, script_query_t *scr_que, void **args)
31                 PyObject *w = NULL;
32                 switch ( scr_que->argv_type[i] ) {
33                         case (QUERY_ARG_INT):
34 -                               w = PyInt_FromLong((long) *(int *) args[i] );
35 +                               w = PyLong_FromVoidPtr( args[i] );
36                                 break;
37                         case (QUERY_ARG_CHARP): {
38                                 char *tmp = *(char **) args[i];
This page took 0.037445 seconds and 3 git commands to generate.