Bug #67905 [NEW]: proc_open leaks file descriptors on error
| From: | jille at hexon dot cx | Date: | Tue, 26 Aug 2014 07:59:46 +0000 |
| Subject: | Bug #67905 [NEW]: proc_open leaks file descriptors on error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187274@lists.php.net to get a copy of this message | ||
From: jille at hexon dot cx
Operating system: n/a
PHP version: master-Git-2014-08-26 (Git)
Package: Program Execution
Bug Type: Bug
Bug description:proc_open leaks file descriptors on error
Description:
------------
proc_open leaks file descriptors when leaving via the exit_fail label.
There is some code to clean them up, but it is only executed when fork()
fails instead of opening one of the descriptors.
References:
https://github.com/php/php-src/blob/c3e3c98/ext/standard/proc_open.c#L512
(goto)
https://github.com/php/php-src/blob/c3e3c98/ext/standard/proc_open.c#L952
(label)
https://github.com/php/php-src/blob/c3e3c98/ext/standard/proc_open.c#L852
(fork failed)
Test script:
---------------
<?php
$descr = array(
0 => array('file', '/dev/null', 'r'),
1 => array('file', '/nonexistent', 'r'),
);
for($i = 0; 1025 > $i; $i++) {
$ph = proc_open('true', $descr, $pipes);
}
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=67905&edit=1
--