summaryrefslogtreecommitdiff
path: root/ext/com_dotnet
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-02-08 17:06:34 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-02-08 17:07:02 +0100
commit01eab11cee751bf64364a0b778e05c9018abb75a (patch)
treec31002edd7438962e6bfa55712aa50d1a8a475a5 /ext/com_dotnet
parentb4f61d99cf90fab429a639a51790591ce296606f (diff)
parentf649adedfe3f0797cd0d6248e1b01c65b326f443 (diff)
downloadphp-git-01eab11cee751bf64364a0b778e05c9018abb75a.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79248: Traversing empty VT_ARRAY throws com_exception
Diffstat (limited to 'ext/com_dotnet')
-rw-r--r--ext/com_dotnet/com_iterator.c2
-rw-r--r--ext/com_dotnet/tests/bug79248.phpt16
2 files changed, 17 insertions, 1 deletions
diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c
index e6f5b84cbd..c3206497cf 100644
--- a/ext/com_dotnet/com_iterator.c
+++ b/ext/com_dotnet/com_iterator.c
@@ -187,7 +187,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
SafeArrayGetUBound(V_ARRAY(&I->safe_array), 1, &I->sa_max);
/* pre-fetch the element */
- if (php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
+ if (I->sa_max >= bound && php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
I->key = bound;
ZVAL_NULL(&ptr);
php_com_zval_from_variant(&ptr, &I->v, I->code_page);
diff --git a/ext/com_dotnet/tests/bug79248.phpt b/ext/com_dotnet/tests/bug79248.phpt
new file mode 100644
index 0000000000..fda67551a7
--- /dev/null
+++ b/ext/com_dotnet/tests/bug79248.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #79248 (Traversing empty VT_ARRAY throws com_exception)
+--SKIPIF--
+<?php
+if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
+?>
+--FILE--
+<?php
+$v = new variant([], VT_ARRAY);
+foreach ($v as $el) {
+ var_dump($el);
+}
+echo "done\n";
+?>
+--EXPECT--
+done