[php-src] PHP-8.4: Zend: zend_call_stack_get_netbsd_pthread() pthread attribute leak.
| From: | David Carlier | Date: | Thu, 15 Oct 2026 02:44:38 +0000 |
| Subject: | [php-src] PHP-8.4: Zend: zend_call_stack_get_netbsd_pthread() pthread attribute leak. | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142300@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-10-15T03:43:22+01:00
Commit: https://github.com/php/php-src/commit/81fd6105bc6b003e5e226aa17a0f1f51201dc812
Raw diff: https://github.com/php/php-src/commit/81fd6105bc6b003e5e226aa17a0f1f51201dc812.diff
Zend: zend_call_stack_get_netbsd_pthread() pthread attribute leak.
Close GH-24245
Changed paths:
M NEWS
M Zend/zend_call_stack.c
Diff:
diff --git a/NEWS b/NEWS
index 4be7ba3fdb1d..e5ff8f8df4d8 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,8 @@ PHP NEWS
. Fix escape analysis for objects implementing ArrayAccess. (ndossche, Arnaud)
. Fix UAF for resolved callable zval. (EdmondDantes)
. Fix memory leak for nested HTTP calls. (EdmondDantes)
+ . Fixed pthread attribute leak in zend_call_stack_get_netbsd_pthread().
+ (David Carlier)
- DOM:
. Fixed bug GH-23352 (UAF reading an attribute value node retained across
diff --git a/Zend/zend_call_stack.c b/Zend/zend_call_stack.c
index ac12b8b7d871..ab00781b47dc 100644
--- a/Zend/zend_call_stack.c
+++ b/Zend/zend_call_stack.c
@@ -591,11 +591,13 @@ static bool zend_call_stack_get_netbsd_pthread(zend_call_stack *stack)
error = pthread_attr_getstack(&attr, &addr, &max_size);
if (error) {
+ pthread_attr_destroy(&attr);
return false;
}
error = pthread_attr_getguardsize(&attr, &guard_size);
if (error) {
+ pthread_attr_destroy(&attr);
return false;
}
@@ -605,6 +607,7 @@ static bool zend_call_stack_get_netbsd_pthread(zend_call_stack *stack)
stack->base = (char *)addr + max_size;
stack->max_size = max_size;
+ pthread_attr_destroy(&attr);
return true;
}
# else