Fix crash when an invalid callback function is passed to CURLMOPT_PUSHFUNCTION

Previously this caused a SIGABRT.

Closes GH-11639.
This commit is contained in:
Niels Dossche 2023-07-08 18:30:28 +02:00
parent bbe72f160d
commit 3ccd8d7866
3 changed files with 63 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_fcall_info_argn(
&fci, 3,
pz_parent_ch,