com php-src: Fixed Bug #66412 readline_clear_history() with libedit causes segfault after #6571 4: NEWS ext/readline/readline.c
| From: | Remi Collet | Date: | Mon, 20 Jan 2014 07:38:53 +0000 |
| Subject: | com php-src: Fixed Bug #66412 readline_clear_history() with libedit causes segfault after #6571 4: NEWS ext/readline/readline.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75701@lists.php.net to get a copy of this message | ||
Commit: 31d67bd35362c1ab570caccedfec3e24257b55c5
Author: Remi Collet <remi@php.net> Mon, 20 Jan 2014 08:38:53 +0100
Parents: 4e55c6bffb9407b3013c90fcf3a840bfc5115ca2
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=31d67bd35362c1ab570caccedfec3e24257b55c5
Log:
Fixed Bug #66412 readline_clear_history() with libedit causes segfault after #65714
Checking all libedit functions, this check is done in each functions (add_history,
read_history, write_history, ...) but is missing in clear_history.
Test coverage: readline_clear_history_001.phpt
Bugs:
https://bugs.php.net/66412
https://bugs.php.net/65714
Changed paths:
M NEWS
M ext/readline/readline.c
Diff:
diff --git a/NEWS b/NEWS
index ce2d100..f03180d 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,10 @@ PHP NEWS
. Fixed bug #66298 (ext/opcache/Optimizer/zend_optimizer.c has dos-style
^M as lineend). (Laruence)
+- Readline
+ . Fixed Bug #66412 (readline_clear_history() with libedit causes segfault after
+ #65714). (Remi)
+
- Session
. Fixed bug #66469 (Session module is sending multiple set-cookie headers when
session.use_strict_mode=1) (Yasuo)
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index ecd5533..4bd9103 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -354,6 +354,11 @@ PHP_FUNCTION(readline_clear_history)
return;
}
+#if HAVE_LIBEDIT
+ /* clear_history is the only function where rl_initialize
+ is not call to ensure correct allocation */
+ using_history();
+#endif
clear_history();
RETURN_TRUE;