From 10c24684ab9cd1c747e251d7cb4590c43eecad6b Mon Sep 17 00:00:00 2001 From: Natasha Lee Date: Thu, 28 Mar 2019 22:49:53 +0000 Subject: [PATCH] Fix use of uninitialized value in ValidateTextureViewDescriptor ValidateTextureViewDescriptor was running into use of uninitialized value. Fixing this by moving the texture state check below the texture object check. This should validate the texture object before trying to validate it's texture state. Bug: chromium:947150 Change-Id: I9b41791bfb960fbe4873ba5fcadf046bd32e5853 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6180 Reviewed-by: Kai Ninomiya Commit-Queue: Natasha Lee --- src/dawn_native/Texture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp index 223d8552a3..573269cc2b 100644 --- a/src/dawn_native/Texture.cpp +++ b/src/dawn_native/Texture.cpp @@ -182,11 +182,12 @@ namespace dawn_native { if (descriptor->nextInChain != nullptr) { return DAWN_VALIDATION_ERROR("nextInChain must be nullptr"); } + + DAWN_TRY(device->ValidateObject(texture)); if (texture->GetTextureState() == TextureBase::TextureState::Destroyed) { return DAWN_VALIDATION_ERROR("Destroyed texture used to create texture view"); } - DAWN_TRY(device->ValidateObject(texture)); DAWN_TRY(ValidateTextureViewDimension(descriptor->dimension)); DAWN_TRY(ValidateTextureFormat(descriptor->format));