Skip to content

ext/com_dotnet: release the held IUnknown in com_get_active_object()#103

Closed
iliaal wants to merge 1 commit into
PHP-8.4from
com-dotnet-active-object-release
Closed

ext/com_dotnet: release the held IUnknown in com_get_active_object()#103
iliaal wants to merge 1 commit into
PHP-8.4from
com-dotnet-active-object-release

Conversation

@iliaal

@iliaal iliaal commented Jun 21, 2026

Copy link
Copy Markdown
Owner

In com_get_active_object() the cleanup block guarded on unk but called IUnknown_Release(obj). On a successful GetActiveObject() that releases the IDispatch proxy twice (it is already released under the obj guard) and leaks the IUnknown returned by GetActiveObject; on a QueryInterface failure obj is NULL so it degrades to IUnknown_Release(NULL). Release unk so each interface pointer is released exactly once. This is Windows-only COM code that I could not build or run on Linux, and the corrupting path needs a live ROT-registered object, so there is no automated test; verified by inspection.

The cleanup block guarded on `unk` but released `obj`, so a successful
GetActiveObject() released the IDispatch proxy twice (once already under
the obj guard) and never released the IUnknown it returned, leaking it.
Release `unk` so each interface pointer is released exactly once.
@iliaal

iliaal commented Jun 21, 2026

Copy link
Copy Markdown
Owner Author

Submitted upstream as php#22378.

@iliaal iliaal closed this Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant