]> granicus.if.org Git - python/commit
[3.5] bpo-29854: Fix segfault in call_readline() (GH-728)
authorNir Soffer <nirsof@gmail.com>
Sun, 9 Jul 2017 10:42:35 +0000 (13:42 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Sun, 9 Jul 2017 10:42:35 +0000 (13:42 +0300)
commit68c3724651776f4ae90ed24d70cef6fd45bc7db5
treed00cdf67b59965c9a65f04a34585293ea0ee5a44
parent3bbdf990a2c1b0b303b950058e3177a1bd5f697a
[3.5] 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