Skip to content

Commit 31d67bd

Browse files
committed
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
1 parent 4e55c6b commit 31d67bd

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ PHP NEWS
1717
. Fixed bug #66298 (ext/opcache/Optimizer/zend_optimizer.c has dos-style
1818
^M as lineend). (Laruence)
1919

20+
- Readline
21+
. Fixed Bug #66412 (readline_clear_history() with libedit causes segfault after
22+
#65714). (Remi)
23+
2024
- Session
2125
. Fixed bug #66469 (Session module is sending multiple set-cookie headers when
2226
session.use_strict_mode=1) (Yasuo)

ext/readline/readline.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,11 @@ PHP_FUNCTION(readline_clear_history)
354354
return;
355355
}
356356

357+
#if HAVE_LIBEDIT
358+
/* clear_history is the only function where rl_initialize
359+
is not call to ensure correct allocation */
360+
using_history();
361+
#endif
357362
clear_history();
358363

359364
RETURN_TRUE;

0 commit comments

Comments
 (0)