Merge branch 'PHP-8.2'

* PHP-8.2:
  Fix crash when an invalid callback function is passed to CURLMOPT_PUSHFUNCTION
This commit is contained in:
Niels Dossche 2023-07-08 21:44:26 +02:00
commit 46a0d043b5
2 changed files with 59 additions and 2 deletions

View file

@ -382,6 +382,11 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
return rval;
}
if (UNEXPECTED(zend_fcall_info_init(&t->func_name, 0, &fci, &t->fci_cache, NULL, NULL) == FAILURE)) {
php_error_docref(NULL, E_WARNING, "Cannot call the CURLMOPT_PUSHFUNCTION");
return CURL_PUSH_OK;
}
parent = Z_CURL_P(pz_parent_ch);
ch = init_curl_handle_into_zval(&pz_ch);
@ -395,8 +400,6 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
add_next_index_string(&headers, header);
}
zend_fcall_info_init(&t->func_name, 0, &fci, &t->fci_cache, NULL, NULL);
ZEND_ASSERT(pz_parent_ch);
zval call_args[3] = {*pz_parent_ch, pz_ch, headers};