Commit 0a7c483077d for php
commit 0a7c483077dc2187d2469409d2cc520e50e7e58b
Merge: 9ba3591b2e2 6485f77dda1
Author: Jakub Zelenka <bukka@php.net>
Date: Sun Nov 29 21:49:41 2026 +0100
Merge branch 'PHP-8.6'
* PHP-8.6:
Fix use-after-free when proc_open() pipe is closed from its user filter
# Conflicts:
# NEWS
# ext/standard/proc_open.c
diff --cc ext/standard/proc_open.c
index 621e61f7a66,63a55b8407b..32d498583fe
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@@ -385,9 -398,16 +398,16 @@@ PHP_FUNCTION(proc_close
RETURN_THROWS();
}
+ for (int i = 0; i < proc->npipes; i++) {
+ if (proc->pipes[i] != NULL && proc_open_pipe_must_not_close(proc->pipes[i])) {
+ php_error_docref(NULL, E_WARNING, "Cannot close the process, as one of its pipes must not be manually closed");
+ RETURN_LONG(-1);
+ }
+ }
+
- FG(pclose_wait) = 1; /* See comment in `proc_open_rsrc_dtor` */
+ FG(pclose_wait) = true; /* See comment in `proc_open_rsrc_dtor` */
zend_list_close(Z_RES_P(zproc));
- FG(pclose_wait) = 0;
+ FG(pclose_wait) = false;
RETURN_LONG(FG(pclose_ret));
}
/* }}} */