File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -794,7 +794,7 @@ static bool zend_call_stack_get_aix_pthread(zend_call_stack *stack)
794794{
795795#ifdef HAVE_PTHREAD_GETTHRDS_NP
796796 pthread_t pt = pthread_self ();
797- struct __pthrdsinfo thread_info ;
797+ struct __pthrdsinfo thread_info = { 0 } ;
798798 /*
799799 * We don't need the register buffer since we only call the function
800800 * on our own thread, and since the register buffer is only used for
@@ -807,13 +807,22 @@ static bool zend_call_stack_get_aix_pthread(zend_call_stack *stack)
807807 return false;
808808 }
809809
810+ /*
811+ * These can be null in rare situations, allegedly with user-provided
812+ * stacks with pthread (according to OpenJDK)
813+ */
814+ if (!(thread_info .__pi_stackend && thread_info .__pi_stackaddr )) {
815+ return false;
816+ }
817+
810818 /*
811819 * The top of the stack (stackend) is not page aligned, there's some
812820 * internal stuff above it. Thankfully, we don't need page alignment.
813821 *
814822 * The size is a little weird. The stacksize field is smaller than
815823 * subtracting the bottom (stackaddr) from the top; it's about 0x888
816- * to 0x1888 above stackaddr.
824+ * to 0x1888 above stackaddr. I'm assuming it rounds the bottom of the
825+ * stack to page alignment?
817826 *
818827 * A somewhat crude diagram is available here:
819828 * https://www.ibm.com/docs/en/aix/7.2.0?topic=tuning-thread-environment-variables
You can’t perform that action at this time.
0 commit comments