[PATCH] Bug #48256 readline crash
| From: | Tim Starling | Date: | Thu, 14 May 2009 02:00:03 +0000 |
| Subject: | [PATCH] Bug #48256 readline crash | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-43922@lists.php.net to get a copy of this message | ||
The readline extension links both libreadline and libhistory. This is
unnecessary, and inspection of the readline example programs since
version 2.0 implies that it has always been unnecessary. Both libraries
include history.o, so linking to both gives you two copies of that module.
The bug occurs when, due to operating system vagaries, libhistory loads
before libreadline. This causes PHP's readline_add_history() to add
history entries to libhistory's copy of the_history. Then when
readline() is called, libreadline attempts to read the other copy of
the_history. The result is a null pointer dereference in libreadline's
previous_history() function.
The solution is to remove all references to libhistory in
ext/readline/config.m4. I have patched this in and tested it.
This bug was closed as "bogus" on bugs.php.net due to some temporary
short-circuit in the mind of a bug tracker admin. It's totally PHP's
fault and there's nothing any distro can do to fix it.
-- Tim Starling