Bug #72998 [Opn->Csd]: readline segfaults php on empty array returned from callback
| From: | git@php.net | Date: | Thu, 03 Jun 2021 08:34:16 +0000 |
| Subject: | Bug #72998 [Opn->Csd]: readline segfaults php on empty array returned from callback | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234181@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72998&edit=1
ID: 72998
Updated by: git@php.net
Reported by: lindsay at notion dot ai
Summary: readline segfaults php on empty array returned from
callback
-Status: Open
+Status: Closed
Type: Bug
Package: Readline related
Operating System: Ubuntu 14.04.3 LTS
PHP Version: 7.0.10
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of krakjoe
Revision: https://github.com/php/php-src/commit/1143155fcb4c54738c2b32f7e5bce0dc16249f1a
Log: fix bug #72998
Previous Comments:
------------------------------------------------------------------------
[2016-09-03 15:59:19] laruence@php.net
I think this is libedit bug, (you are using libedit, right?)
https://github.com/ThomasAdam/libedit/blob/cabe0cf6a78a93fc9389e5fe1e3814790a6d8787/src/filecomplete.c#L358
seems it doesn't expect to accept an return like ["", NULL];
------------------------------------------------------------------------
[2016-09-02 22:16:34] lindsay at notion dot ai
Incorrectly submitted ticket with my desktop os as osx. I'm actually running this on linux
ubuntu 14.04 kernel 3.19.0-25
------------------------------------------------------------------------
[2016-09-01 21:04:20] lindsay at notion dot ai
Description:
------------
If the callback for readline_completion_function returns an empty array, php will segfault.
When running the example code, hit tab to fire the callback.
Test script:
---------------
<?php
readline_completion_function('readline_callback');
do
{
$command = readline('> ');
echo 'command: ' . $command . PHP_EOL;
} while ($command);
function readline_callback($command)
{
return [];
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72998&edit=1