HomePhabricator

Fix XHProf segfault when calling internal functions in PHP 5.5

Description

Fix XHProf segfault when calling internal functions in PHP 5.5

Summary:
Fixes https://github.com/phacility/xhprof/pull/33. Since the issue with that patch was CLA, I developed this independently.

This works because it just inlines the body of execute_internal(), which is nearly identical:

ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC)
{
	if(fci != NULL) {
		((zend_internal_function *) execute_data_ptr->function_state.function)->handler(fci->param_count,
				*fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC);

	} else {
		zval **return_value_ptr = &EX_TMP_VAR(execute_data_ptr, execute_data_ptr->opline->result.var)->var.ptr;
		((zend_internal_function *) execute_data_ptr->function_state.function)->handler(execute_data_ptr->opline->extended_value, *return_value_ptr,
					(execute_data_ptr->function_state.function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)?return_value_ptr:NULL,
					execute_data_ptr->object, return_value_used TSRMLS_CC);
	}
}

Test Plan: Failing test now passes. No more segfaults on PHP 5.5.8.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D10375

Details

Provenance
epriestleyAuthored on
epriestleyPushed on Aug 28 2014, 5:34 PM
Reviewer
btrahan
Differential Revision
D10375: Fix XHProf segfault when calling internal functions in PHP 5.5
Parents
rXPRFd8ca30af371e: Add a failing test case for the XHProf PHP 5.5 segfault
Branches
Unknown
Tags
Unknown

Event Timeline