From 3fd022ef60417eb15e6d5b82318c763f26024888 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Thu, 3 Oct 2019 14:40:09 +0000 Subject: [PATCH] Validate injected errors are not NoError HandleError assumes that the error is not NoError. InjectError is an untrusted wire command and needs to validate that NoError is not passed. Bug: chromium:1010703, chromium:1004368 Change-Id: Id48a877ded327a6e3a54fedb2be2c54eeca5cd3c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11780 Reviewed-by: Corentin Wallez Reviewed-by: Kai Ninomiya Commit-Queue: Austin Eng --- src/dawn_native/Device.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index 0c76a574b2..2a6b915280 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -102,7 +102,11 @@ namespace dawn_native { if (ConsumedError(ValidateErrorType(type))) { return; } - mCurrentErrorScope->HandleError(type, message); + if (DAWN_UNLIKELY(type == dawn::ErrorType::NoError)) { + HandleError(dawn::ErrorType::Validation, "Invalid injected error NoError"); + return; + } + HandleError(type, message); } void DeviceBase::ConsumeError(ErrorData* error) {