Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMPersistHelper::LoadFromStream() can segfault #17658

Open
cmb69 opened this issue Jan 31, 2025 · 0 comments · May be fixed by #17659
Open

COMPersistHelper::LoadFromStream() can segfault #17658

cmb69 opened this issue Jan 31, 2025 · 0 comments · May be fixed by #17659

Comments

@cmb69
Copy link
Member

cmb69 commented Jan 31, 2025

Description

COMPersistHelper::LoadFromStream() segfaults if the COM object implements IPersistStream but not IPersistStreamInit:

res = get_persist_stream(helper);
if (helper->ips) {
res = IPersistStreamInit_Load(helper->ipsi, stm);
}

PHP Version

PHP 5.0

Operating System

Windows

@cmb69 cmb69 self-assigned this Jan 31, 2025
cmb69 added a commit to cmb69/php-src that referenced this issue Jan 31, 2025
The actual fix is trivial, but to be able to test the behavior we have
to introduce an own COM object, since existing persistable objects
likely implement `IPersistInit`, not only `IPersist`.  We also want to
avoid further test dependencies on possibly unavailable objects, such
as `Word.Application`.

To this purposes, we add a small COM in-process server, which may be
extended for other testing purposes.  We keep it simple by implementing
it in C++, but without using any more sophisticated frameworks like ATL.

This component needs to be built explicitly (`nmake comtest.dll`), and
also needs to be explicitly registered (`nmake register_comtest`).
When no longer needed, it is possible to unregister the component
(`nmake unregister_comtest`).
@cmb69 cmb69 linked a pull request Jan 31, 2025 that will close this issue
1 task
@cmb69 cmb69 changed the title COMPersistHelper::LoadFromStream() segfaults for IPersistStream COMPersistHelper::LoadFromStream() can segfault Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant