1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-16769: php_pcntl_set_user_signal_infos aborts when a signal is a reference.

close GH-16772
This commit is contained in:
David Carlier
2024-11-13 07:07:11 +00:00
parent f6256fa2c0
commit b8115d6c5e
3 changed files with 23 additions and 0 deletions

4
NEWS
View File

@@ -14,6 +14,10 @@ PHP NEWS
- Hash:
. Fixed GH-16711: Segfault in mhash(). (Girgias)
- PCNTL:
. Fixed bug GH-16769: (pcntl_sigwaitinfo aborts on signal value
as reference). (David Carlier)
- PDO:
. Fixed memory leak of `setFetchMode()`. (SakiTakamachi)

View File

@@ -874,6 +874,7 @@ static bool php_pcntl_set_user_signal_infos(
zval *user_signal_no;
ZEND_HASH_FOREACH_VAL(user_signals, user_signal_no) {
bool failed = true;
ZVAL_DEREF(user_signal_no);
zend_long tmp = zval_try_get_long(user_signal_no, &failed);
if (failed) {

View File

@@ -0,0 +1,18 @@
--TEST--
pcntl_sigwaitinfo abort when signals is an array with self-reference.
--EXTENSIONS--
pcntl
--SKIPIF--
<?php if (!function_exists("pcntl_sigwaitinfo")) die("skip pcntl_sigwaitinfo() not available"); ?>
--FILE--
<?php
$a[0] = &$a;
try {
pcntl_sigwaitinfo($a,$a);
} catch(\TypeError $e) {
echo $e->getMessage();
}
?>
--EXPECT--
pcntl_sigwaitinfo(): Argument #1 ($signals) signals must be of type int, array given