Skip to content

Commit ee6a71c

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #78694: Appending to a variant array causes segfault
2 parents 650115c + ce035dc commit ee6a71c

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.4.0RC5
44

5+
- COM:
6+
. Fixed bug #78694 (Appending to a variant array causes segfault). (cmb)
7+
58
- Date:
69
. Fixed bug #70153 (\DateInterval incorrectly unserialized). (Maksim Iakunin)
710

ext/com_dotnet/com_handlers.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ static void com_write_dimension(zval *object, zval *offset, zval *value)
124124

125125
obj = CDNO_FETCH(object);
126126

127+
if (offset == NULL) {
128+
php_com_throw_exception(DISP_E_BADINDEX, "appending to variants is not supported");
129+
return;
130+
}
131+
127132
if (V_VT(&obj->v) == VT_DISPATCH) {
128133
ZVAL_COPY_VALUE(&args[0], offset);
129134
ZVAL_COPY_VALUE(&args[1], value);

ext/com_dotnet/tests/bug78694.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #78694 (Appending to a variant array causes segfault)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
foreach ([new com('WScript.Shell'), new variant([])] as $var) {
10+
try {
11+
$var[] = 42;
12+
} catch (com_exception $ex) {
13+
var_dump($ex->getMessage());
14+
}
15+
}
16+
?>
17+
--EXPECT--
18+
string(38) "appending to variants is not supported"
19+
string(38) "appending to variants is not supported"

0 commit comments

Comments
 (0)