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 <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2023-04-25 16:46:40 +00:00 committed by Dawn LUCI CQ
parent 648db6cfb2
commit 2dc9fe842d
1 changed files with 2 additions and 1 deletions

View File

@ -435,7 +435,8 @@ void* BufferBase::GetMappedRange(size_t offset, size_t size, bool writable) {
return static_cast<uint8_t*>(mStagingBuffer->GetMappedPointer()) + offset;
}
if (mSize == 0) {
return reinterpret_cast<uint8_t*>(intptr_t(0xCAFED00D));
static uint32_t zeroRange = 0xCAFED00D;
return &zeroRange;
}
uint8_t* start = static_cast<uint8_t*>(GetMappedPointer());
return start == nullptr ? nullptr : start + offset;