Fix null pointer dereference in CommandBufferStateTracker

The CommandBufferStateTracker dereferences a null pointer if there is no bind group set for an index of the layout

Change-Id: Id247f9876340d189088e8bbe8cb4d68a4d517c6e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6100
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng
2019-03-28 15:28:01 +00:00
committed by Commit Bot service account
parent 0bc168ed58
commit 27a294c2e8
3 changed files with 120 additions and 1 deletions

View File

@@ -91,7 +91,8 @@ namespace dawn_native {
bool matches = true;
for (uint32_t i : IterateBitSet(mLastPipelineLayout->GetBindGroupLayoutsMask())) {
if (mLastPipelineLayout->GetBindGroupLayout(i) != mBindgroups[i]->GetLayout()) {
if (mBindgroups[i] == nullptr ||
mLastPipelineLayout->GetBindGroupLayout(i) != mBindgroups[i]->GetLayout()) {
matches = false;
break;
}