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

[Error Handling] Fix DxcContainerBuilder error handling #7056

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

Conversation

bob80905
Copy link
Collaborator

Some error handling changes were incorrectly made to the container assembler, as described in the issue below.
This is bad because the API protocol for error handling must remain consistent across all functions. This PR
aims to restore the correct semantic meaning of returning bad HR values.
Fixes #7051

@bob80905 bob80905 requested a review from a team as a code owner January 11, 2025 00:51
Copy link
Contributor

@tex3d tex3d left a comment

Choose a reason for hiding this comment

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

If this succeeded testing without the suggested change to check valHR before hashing, we are missing a test that makes sure it doesn't hash the shader even when validation fails.

Comment on lines 107 to +110
DxcThreadMalloc TM(m_pMalloc);
if (ppResult == nullptr)
return E_INVALIDARG;

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
DxcThreadMalloc TM(m_pMalloc);
if (ppResult == nullptr)
return E_INVALIDARG;
if (ppResult == nullptr)
return E_INVALIDARG;
DxcThreadMalloc TM(m_pMalloc);

Comment on lines +168 to +172
LPVOID PTR = pResult->GetBufferPointer();
if (!IsDxilContainerLike(PTR, pResult->GetBufferSize()))
return E_FAIL;

HashAndUpdate((DxilContainerHeader *)PTR);
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, IsDxilContainerLike should never fail here, and it returns the DxilContainerHeader * upon success. Plus, we need to make sure validation succeeded before hashing:

Suggested change
LPVOID PTR = pResult->GetBufferPointer();
if (!IsDxilContainerLike(PTR, pResult->GetBufferSize()))
return E_FAIL;
HashAndUpdate((DxilContainerHeader *)PTR);
if (SUCCEEDED(valHR))
HashAndUpdate(IsDxilContainerLike(pResult->GetBufferPointer(),
pResult->GetBufferSize()));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

Regression in ContainerBuilder error handling code introduced by #6853
2 participants