diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-08-27 10:25:01 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-08-27 10:26:15 +0200 |
commit | f956434df280003994e931197cd6f648f3ea8486 (patch) | |
tree | f531e4c713cbca4e5a6c6596b10a080507244c91 | |
parent | bd6feb7b120bcfe0436ec878ea0f8e260ddcf772 (diff) | |
parent | 296030119cec2c1c543b3397dc84977e592a4747 (diff) | |
download | php-git-f956434df280003994e931197cd6f648f3ea8486.tar.gz |
Merge branch 'PHP-7.4' into master
* PHP-7.4:
Catch potential exceptions during to string conversion
-rw-r--r-- | ext/com_dotnet/com_com.c | 20 | ||||
-rw-r--r-- | ext/com_dotnet/com_saproxy.c | 10 |
2 files changed, 23 insertions, 7 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 7a98481927..99a217342a 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -81,7 +81,9 @@ PHP_METHOD(com, __construct) if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params), "Server", sizeof("Server")-1))) { - convert_to_string_ex(tmp); + if (!try_convert_to_string(tmp)) { + RETURN_THROWS(); + } server_name = Z_STRVAL_P(tmp); server_name_len = Z_STRLEN_P(tmp); ctx = CLSCTX_REMOTE_SERVER; @@ -89,21 +91,27 @@ PHP_METHOD(com, __construct) if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params), "Username", sizeof("Username")-1))) { - convert_to_string_ex(tmp); + if (!try_convert_to_string(tmp)) { + RETURN_THROWS(); + } user_name = Z_STRVAL_P(tmp); user_name_len = Z_STRLEN_P(tmp); } if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params), "Password", sizeof("Password")-1))) { - convert_to_string_ex(tmp); + if (!try_convert_to_string(tmp)) { + RETURN_THROWS(); + } password = Z_STRVAL_P(tmp); password_len = Z_STRLEN_P(tmp); } if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params), "Domain", sizeof("Domain")-1))) { - convert_to_string_ex(tmp); + if (!try_convert_to_string(tmp)) { + RETURN_THROWS(); + } domain_name = Z_STRVAL_P(tmp); domain_name_len = Z_STRLEN_P(tmp); } @@ -715,7 +723,9 @@ PHP_FUNCTION(com_event_sink) if ((tmp = zend_hash_index_find(Z_ARRVAL_P(sink), 1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) dispname = Z_STRVAL_P(tmp); } else if (sink != NULL) { - convert_to_string(sink); + if (!try_convert_to_string(sink)) { + RETURN_THROWS(); + } dispname = Z_STRVAL_P(sink); } diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index dbb00b1596..56f7fc6846 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -105,7 +105,10 @@ static zval *saproxy_read_dimension(zend_object *object, zval *offset, int type, } ZVAL_COPY_VALUE(&args[i-1], offset); - convert_to_string(&proxy->indices[0]); + if (!try_convert_to_string(&proxy->indices[0])) { + efree(args); + return rv; + } VariantInit(&v); res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), @@ -220,7 +223,10 @@ static void saproxy_write_dimension(zend_object *object, zval *offset, zval *val ZVAL_COPY_VALUE(&args[i-1], offset); ZVAL_COPY_VALUE(&args[i], value); - convert_to_string(&proxy->indices[0]); + if (!try_convert_to_string(&proxy->indices[0])) { + efree(args); + return; + } VariantInit(&v); if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, |