]> granicus.if.org Git - python/commit
bpo-29854: Fix segfault in call_readline() (GH-728)
authorNir Soffer <nirsof@gmail.com>
Fri, 7 Jul 2017 06:10:46 +0000 (09:10 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Fri, 7 Jul 2017 06:10:46 +0000 (09:10 +0300)
commitfae8f4a9cb88a68eb14750cbb8ddf8740fd67b8b
treee94fb9176f0309f41cb51fa3f16ba616d94d7ebd
parent25a4206c243e3b1fa6f5b1c72a11b409b007694d
bpo-29854: Fix segfault in call_readline() (GH-728)

If history-length is set in .inputrc, and the history file is double the
history size (or more), history_get(N) returns NULL, and python
segfaults. Fix that by checking for NULL return value.

It seems that the root cause is incorrect handling of bigger history in
readline, but Python should not segfault even if readline returns
unexpected value.

This issue affects only GNU readline. When using libedit emulation
system history size option does not work.
Lib/test/test_readline.py
Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst [new file with mode: 0644]
Modules/readline.c