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

Fix GH-17658: COMPersistHelper::LoadFromStream() can segfault #17659

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented 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).

TODO

  • call COMPersistHelper::InitNew() in the test case to ensure that IPersistInit is not implemented (might later happen by accident, rendering the regression test useless)

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 marked this pull request as ready for review February 1, 2025 00:48
@cmb69 cmb69 requested a review from TimWolla as a code owner February 1, 2025 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

COMPersistHelper::LoadFromStream() can segfault
1 participant