Page MenuHomePhabricator

Fix XHProf segfault when calling internal functions in PHP 5.5
ClosedPublic

Authored by epriestley on Aug 27 2014, 11:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 10:25 AM
Unknown Object (File)
Sun, Nov 10, 5:38 AM
Unknown Object (File)
Sun, Nov 10, 5:10 AM
Unknown Object (File)
Sun, Nov 10, 2:02 AM
Unknown Object (File)
Sun, Nov 10, 1:53 AM
Unknown Object (File)
Sun, Nov 10, 1:50 AM
Unknown Object (File)
Sun, Nov 10, 1:21 AM
Unknown Object (File)
Oct 8 2024, 11:56 PM
Subscribers

Details

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.

Diff Detail

Repository
rXPRF XHProf
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Fix XHProf segfault when calling internal functions in PHP 5.5.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Aug 28 2014, 5:23 PM
epriestley updated this revision to Diff 24984.

Closed by commit rXPRF55a47c0d8ffe (authored by @epriestley).