-
Notifications
You must be signed in to change notification settings - Fork 683
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
[Validator] Check size of PSV. #6924
Conversation
Check size of PSV part matches the PSVVersion. Updated DxilPipelineStateValidation::ReadOrWrite to read based on initInfo.PSVVersion. And return fail when size mismatch in RWMode::Read. Fixes microsoft#6817
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.
Should not block loading of newer PSV versions. Need to do this only in the validator code.
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.
In addition to the comments, we should be checking the string and index tables more thoroughly:
- check that string table is well formed - size is aligned, buffer ends with
\0
- check that accesses to string table entries are in-bounds, before using the value.
- check that accesses to index table entries are in-bounds, and that the (index+1)+size is within dword size of index table, before using the index array.
Then use PSVInitInfo to calculate correct size of PSV.
✅ With the latest revision this PR passed the C/C++ code formatter. |
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.
Mainly, I think we need to do away with the extra size check based on module facts, since it would only hit this, after other checks passed, when it would be better to report a more specific mismatch later.
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.
Looks good!
Couple other questions that may not need resolution:
Are these cases worth testing? |
Added test to force these values to 0. No resources happen a lot. |
Thanks, this is good, though what I meant to ask for at first was a test that ensures that the PSV is valid when there are no resources / 0 table size / no semantic index table entries. It would ensure that the PSV won't contain the table size as a part if the table size is 0. But these tests seem to be another way to validate that. |
Check size of PSV part matches the PSVVersion.
Updated DxilPipelineStateValidation::ReadOrWrite to read based on initInfo.PSVVersion.
And return fail when size mismatch in RWMode::Read.
Fixes #6817