Skip to content

Commit a4874bb

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-16991: Getting typeinfo of non DISPATCH variant segfaults
2 parents 6f05d96 + 9bae893 commit a4874bb

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ PHP NEWS
66
. Fixed jdtogregorian overflow. (David Carlier)
77
. Fixed cal_to_jd julian_days argument overflow. (David Carlier)
88

9+
- COM:
10+
. Fixed bug GH-16991 (Getting typeinfo of non DISPATCH variant segfaults).
11+
(cmb)
12+
913
- Core:
1014
. Fail early in *nix configuration build script. (hakre)
1115
. Fixed bug GH-16727 (Opcache bad signal 139 crash in ZTS bookworm

ext/com_dotnet/com_typeinfo.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ ITypeInfo *php_com_locate_typeinfo(zend_string *type_lib_name, php_com_dotnet_ob
331331
if (obj->typeinfo) {
332332
ITypeInfo_AddRef(obj->typeinfo);
333333
return obj->typeinfo;
334-
} else {
334+
} else if (V_VT(&obj->v) == VT_DISPATCH) {
335335
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &typeinfo);
336336
if (typeinfo) {
337337
return typeinfo;

ext/com_dotnet/tests/gh16991.phpt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
GH-16991 (Getting typeinfo of non DISPATCH variant segfaults)
3+
--EXTENSIONS--
4+
com_dotnet
5+
--FILE--
6+
<?php
7+
com_print_typeinfo(new variant("hello"));
8+
?>
9+
--EXPECTF--
10+
Warning: com_print_typeinfo(): Unable to find typeinfo using the parameters supplied in %s on line %d

0 commit comments

Comments
 (0)