ext/zip: Cancel operation if user callback throws an exception

This commit is contained in:
Gina Peter Banyard 2025-01-10 13:08:51 +00:00
parent 79b9fe334a
commit dccd4af9aa
2 changed files with 9 additions and 5 deletions

View file

@ -3070,10 +3070,12 @@ static int php_zip_cancel_callback(zip_t *arch, void *ptr)
ze_zip_object *obj = ptr;
zend_call_known_fcc(&obj->cancel_callback, &cb_retval, 0, NULL, NULL);
if (!Z_ISUNDEF(cb_retval)) {
retval = zval_get_long(&cb_retval);
zval_ptr_dtor(&cb_retval);
if (Z_ISUNDEF(cb_retval)) {
/* Cancel if an exception has been thrown */
return -1;
}
retval = zval_get_long(&cb_retval);
zval_ptr_dtor(&cb_retval);
return retval;
}