Skip to content

Initialize *ppv in comhost DllGetClassObject - #128916

Merged
elinor-fung merged 2 commits into
mainfrom
copilot/fix-dllgetclassobject-initialization
Jun 3, 2026
Merged

elinor-fung merged 2 commits into
mainfrom
copilot/fix-dllgetclassobject-initialization

Conversation

Copilot AI commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

DllGetClassObject in src/native/corehost/comhost/comhost.cpp had failure paths (CLSID not in map, get_com_delegate failure) that returned a failure HRESULT without writing to *ppv, violating the COM contract that out parameters must always be initialized.

Null it out on function entry.

Copilot AI self-assigned this Jun 2, 2026
Copilot AI review requested due to automatic review settings June 2, 2026 18:32
Copilot AI removed the request for review from Copilot June 2, 2026 18:32
Copilot AI linked an issue Jun 2, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 18:37
Copilot AI changed the title [WIP] Fix DllGetClassObject to initialize out parameter Initialize *ppv in comhost DllGetClassObject Jun 2, 2026
Copilot AI requested a review from elinor-fung June 2, 2026 18:37
@elinor-fung
elinor-fung marked this pull request as ready for review June 2, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the comhost COM entrypoint DllGetClassObject to ensure its ppv out-parameter is initialized on all exit paths, by validating ppv and setting *ppv = nullptr at function entry.

Changes:

  • Add an early ppv == nullptr guard returning E_POINTER.
  • Initialize *ppv to nullptr before any failure-return paths are possible.
Show a summary per file
File Description
src/native/corehost/comhost/comhost.cpp Ensures DllGetClassObject initializes the COM out parameter (*ppv) even when returning failure HRESULTs.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/native/corehost/comhost/comhost.cpp Resolved
@elinor-fung
elinor-fung merged commit 3b0dd88 into main Jun 3, 2026
182 of 186 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Jun 3, 2026
@elinor-fung
elinor-fung deleted the copilot/fix-dllgetclassobject-initialization branch June 3, 2026 21:38
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 4, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

DllGetClassObject does not reliably initialize its out pararameter

4 participants