NVIDIA-RTX / NVIDIA-RTX/Streamline

DXGI interfaces are released before their last use in Generic::getVendorId

Open Beginner friendly
#120 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.2k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

Problem

Generic::getVendorId releases both acquired COM interfaces before using them:

IDXGIDevice* dxgiDevice{};
if (SUCCEEDED(((IUnknown*)m_typelessDevice)->QueryInterface(&dxgiDevice)))
{
    dxgiDevice->Release();
    IDXGIAdapter* adapter{};
    if (SUCCEEDED(dxgiDevice->GetAdapter(&adapter)))
    {
        adapter->Release();
        DXGI_ADAPTER_DESC desc;
        if (SUCCEEDED(adapter->GetDesc(&desc)))

Source: generic.cpp at e8aaa6e. The same pattern is present on current main.

An outstanding reference to the original device does not guarantee that a separately acquired interface wrapper remains alive. COM permits independently managed tear-off interfaces; the returned pointer must remain owned until its final use. See Microsoft's reference-counting guidance.

This permits use-after-release at dxgiDevice->GetAdapter and independently at adapter->GetDesc, even if conventional native implementations happen to retain those objects internally.

Proposed fix

Keep both acquired references until scope exit using the existing WRL ComPtr convention. This preserves the HRESULT checks, return values, and unchanged output on failure, while releasing each reference on all exits.

A focused fix is available in northaxosky/Streamline commit 2e83322: one file, five insertions and six deletions. I attempted to submit it as a PR, but this repository currently has pull requests disabled.

Validation and limits

The modified translation unit compiled with MSVC. A local source-extracted lifetime harness exercises the success/error paths and independently reference-counted interface test doubles; retaining the interfaces removes its lifetime violations. This is a focused ownership check, not a full COM conformance or SDK integration test.

A full SDK build was not completed in this environment. Investigation began after a RenderDoc-enabled D3D11 application encountered an exception during Streamline device registration, but exact attribution of that application exception to this function has not been established. This report stands on the source-level ownership defect, not a claimed reproduction of that particular crash. No application binaries, captures, or crash dumps are attached.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in source/platforms/sl.chi/generic.cpp at Generic::getVendorId, around lines 349-367, and inspect the existing WRL ComPtr convention. Keep the acquired DXGI interfaces owned through their final uses, preserving the HRESULT checks and failure behavior. Validate with the focused lifetime harness or by compiling the modified translation unit with MSVC.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.