-
Notifications
You must be signed in to change notification settings - Fork 713
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
base: main
Are you sure you want to change the base?
[Error Handling] Fix DxcContainerBuilder error handling #7056
Conversation
There was a problem hiding this 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.
DxcThreadMalloc TM(m_pMalloc); | ||
if (ppResult == nullptr) | ||
return E_INVALIDARG; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DxcThreadMalloc TM(m_pMalloc); | |
if (ppResult == nullptr) | |
return E_INVALIDARG; | |
if (ppResult == nullptr) | |
return E_INVALIDARG; | |
DxcThreadMalloc TM(m_pMalloc); |
LPVOID PTR = pResult->GetBufferPointer(); | ||
if (!IsDxilContainerLike(PTR, pResult->GetBufferSize())) | ||
return E_FAIL; | ||
|
||
HashAndUpdate((DxilContainerHeader *)PTR); |
There was a problem hiding this comment.
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:
LPVOID PTR = pResult->GetBufferPointer(); | |
if (!IsDxilContainerLike(PTR, pResult->GetBufferSize())) | |
return E_FAIL; | |
HashAndUpdate((DxilContainerHeader *)PTR); | |
if (SUCCEEDED(valHR)) | |
HashAndUpdate(IsDxilContainerLike(pResult->GetBufferPointer(), | |
pResult->GetBufferSize())); |
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