From 2dc9fe842df96949b23848ec24410846ea984fa1 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Tue, 25 Apr 2023 16:46:40 +0000 Subject: [PATCH] Return static pointer address for zero-length GetMappedRange Bug: chromium:1430985 Change-Id: I0d13fce695bd999dd9e6a8127b91cea15276df22 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128960 Kokoro: Kokoro Reviewed-by: Corentin Wallez Commit-Queue: Austin Eng --- src/dawn/native/Buffer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dawn/native/Buffer.cpp b/src/dawn/native/Buffer.cpp index a110a5fd38..2ca3672963 100644 --- a/src/dawn/native/Buffer.cpp +++ b/src/dawn/native/Buffer.cpp @@ -435,7 +435,8 @@ void* BufferBase::GetMappedRange(size_t offset, size_t size, bool writable) { return static_cast(mStagingBuffer->GetMappedPointer()) + offset; } if (mSize == 0) { - return reinterpret_cast(intptr_t(0xCAFED00D)); + static uint32_t zeroRange = 0xCAFED00D; + return &zeroRange; } uint8_t* start = static_cast(GetMappedPointer()); return start == nullptr ? nullptr : start + offset;