Adding multiple of 4 validation on indirect draws and dispatches

Bug: dawn:538
Change-Id: I6f4d8fb73a9fff910bdcd105f66299dc6afb61cd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29761
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Enrico Galli
2020-10-10 00:06:30 +00:00
committed by Commit Bot service account
parent 793a07e366
commit 1c25198384
4 changed files with 24 additions and 0 deletions

View File

@@ -70,6 +70,10 @@ namespace dawn_native {
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
DAWN_TRY(GetDevice()->ValidateObject(indirectBuffer));
if (indirectOffset % 4 != 0) {
return DAWN_VALIDATION_ERROR("Indirect offset must be a multiple of 4");
}
if (indirectOffset >= indirectBuffer->GetSize() ||
indirectOffset + kDispatchIndirectSize > indirectBuffer->GetSize()) {
return DAWN_VALIDATION_ERROR("Indirect offset out of bounds");