Re: process crash when a plpython function returns unicode
От | Michael Fuhr |
---|---|
Тема | Re: process crash when a plpython function returns unicode |
Дата | |
Msg-id | 20050615191106.GA59738@winnie.fuhr.org обсуждение исходный текст |
Ответ на | process crash when a plpython function returns unicode (Zac <zaccheob@inwind.it>) |
Список | pgsql-bugs |
On Wed, Jun 15, 2005 at 02:29:27PM +0200, Zac wrote: > if you define a plpythonu function that returns a unicode python string > the server process crashes calling that function. The crash happens if the Unicode string has the high bit set. For example, u'\x7f' doesn't cause a crash, but u'\x80' does. Here's a stack trace from HEAD and Python 2.4.1: #0 0xfec6967c in PyString_AsString (op=0x0) at Objects/stringobject.c:698 #1 0xfed76a38 in PLy_function_handler (fcinfo=0xffbfde28, proc=0x47c610) at plpython.c:777 #2 0xfed77df4 in plpython_call_handler (fcinfo=0xffbfde28) at plpython.c:352 Lines 776-77 in plpython.c are: plrv_so = PyObject_Str(plrv); plrv_sc = PyString_AsString(plrv_so); PyObject_Str() is documented to return NULL on failure: http://www.python.org/doc/2.4.1/api/object.html Apparently PyString_AsString() isn't expecting a NULL argument, so the code should probably check the return value of PyObject_Str() before calling PyString_AsString(). -- Michael Fuhr http://www.fuhr.org/~mfuhr/
В списке pgsql-bugs по дате отправления: