]> granicus.if.org Git - python/commit
[3.6] bpo-29854: Fix segfault in call_readline() (GH-728)
authorNir Soffer <nirsof@gmail.com>
Sat, 8 Jul 2017 18:51:21 +0000 (21:51 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Sat, 8 Jul 2017 18:51:21 +0000 (21:51 +0300)
commit04f77d4677e7508b6ec8de9d0331fdabbcd11d30
treea221699df6ca87da7301f344ed97ce7bfc83e837
parent03e0df66b8ce0a8d980eb2092b7c6464d26db14e
[3.6] 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