[ python-Bugs-1086603 ] segfault in readline
SourceForge.net
noreply at sourceforge.net
Mon Dec 20 11:57:08 CET 2004
Bugs item #1086603, was opened at 2004-12-17 03:02
Message generated for change (Comment added) made by quiver
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1086603&group_id=5470
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: DSM (dsm001)
Assigned to: Nobody/Anonymous (nobody)
Summary: segfault in readline
Initial Comment:
It's possible to produce segfaults using two functions
from the
readline module by giving them negative values (GNU
readline 4.3-10),
at least in some circumstances.
Python 2.5a0 (#10, Dec 15 2004, 19:53:33)
[GCC 3.3.3 (Debian 20040401)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import readline
[25290 refs]
>>> readline.remove_history_item(-1)
Segmentation fault
>>> readline.replace_history_item(-1,'abc')
Segmentation fault
gdb reveals it happens because the (external)
remove_history and replace_history_entry don't return
NULL in these cases. I'm not sure whether we're
responsible for checking the sanity of inputs or the
GNU code should be returning NULL and isn't, but at
least sometimes it doesn't.
----------------------------------------------------------------------
Comment By: George Yoshida (quiver)
Date: 2004-12-20 19:57
Message:
Logged In: YES
user_id=671362
I'm +1 for sanity checking rather than waiting for the GNU
readline to return NULL in these functions.
It's just adding a few lines of code right after
PyArg_ParseTuple :
if (entry_number < 0) {
PyErr_SetString(PyExc_ValueError,
"index cannot be a negative value");
return NULL;
}
Then you can work around the problem without worrying
about the return value of remove_history nor
replace_history_entry.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2004-12-20 01:41
Message:
Logged In: YES
user_id=6656
Do you want to fix it then? :) I can't imagine it's that hard, but it would
be easier for someone who can test that their fix helps...
----------------------------------------------------------------------
Comment By: George Yoshida (quiver)
Date: 2004-12-18 19:45
Message:
Logged In: YES
user_id=671362
FYI, I can reproduce this with :
- Python 2.4 & readline 4.3 under SuSE 9.1
- Python 2.5(snapshot as of 2004-12-17) & readline 4.3 under
SuSE 9.1
- Python 2.4 & readline 4.3.5(?) under Cygwin
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2004-12-17 23:18
Message:
Logged In: YES
user_id=6656
Hmm. I can't reproduce this (also with readline 4.3). Odd.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1086603&group_id=5470
More information about the Python-bugs-list
mailing list