From c56860e27fb3390a955ecc4ba5c8895b403046cb Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 20 Nov 2018 09:31:45 +0000 Subject: [PATCH] WireServer: Check for ID 0 in hand-written handlers. BUG=chromium:905272 Change-Id: Ib8efb307dbdd6fc57d2cc75366f238c4dfb2beea Reviewed-on: https://dawn-review.googlesource.com/c/2563 Reviewed-by: Kai Ninomiya Reviewed-by: Stephen White Reviewed-by: Corentin Wallez Commit-Queue: Corentin Wallez --- generator/templates/dawn_wire/WireServer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/generator/templates/dawn_wire/WireServer.cpp b/generator/templates/dawn_wire/WireServer.cpp index 6b00cb225d..945f56539a 100644 --- a/generator/templates/dawn_wire/WireServer.cpp +++ b/generator/templates/dawn_wire/WireServer.cpp @@ -542,6 +542,11 @@ namespace dawn_wire { uint32_t requestStart = cmd->start; bool isWrite = cmd->isWrite; + //* The null object isn't valid as `self` + if (bufferId == 0) { + return false; + } + auto* buffer = mKnownBuffer.Get(bufferId); if (buffer == nullptr) { return false; @@ -585,6 +590,11 @@ namespace dawn_wire { ObjectId bufferId = cmd->bufferId; size_t dataLength = cmd->dataLength; + //* The null object isn't valid as `self` + if (bufferId == 0) { + return false; + } + auto* buffer = mKnownBuffer.Get(bufferId); if (buffer == nullptr || !buffer->valid || buffer->mappedData == nullptr || buffer->mappedDataSize != dataLength) {