Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 436df12fad2091d6859324000ad00dd8714835dc
      
https://github.com/WebKit/WebKit/commit/436df12fad2091d6859324000ad00dd8714835dc
  Author: Mike Wyrzykowski <[email protected]>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    M Source/WebCore/Modules/WebGPU/GPUTexture.cpp
    M Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm
    M Source/WebGPU/WebGPU/Buffer.h
    M Source/WebGPU/WebGPU/Buffer.mm

  Log Message:
  -----------
  [WebGPU] RemoteBuffer::getMappedRange may fail on invalid buffers
https://bugs.webkit.org/show_bug.cgi?id=269275
<radar://122399176>

Reviewed by Tadeu Zagallo.

Buffer::getMappedRange returns nullptr if validation failed,
but previously returned an empty buffer for invalid buffers.

This leads to incorrect behaviors as offset is not validated
and may be outside the range of the buffer. Furthermore, creating
an empty buffer of an arbitrary size is unnecessary.

Address this by matching the behavior of returning nullptr which
is handled correctly at the one call site of Buffer::getMappedRange.

All api,operation,buffer,* and api,validation,buffers,* CTS
test pass after this change.

* Source/WebCore/Modules/WebGPU/GPUTexture.cpp:
(WebCore::GPUTexture::createView const):
* Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm:
(WebCore::GPUCanvasContextCocoa::configure):
* Source/WebGPU/WebGPU/Buffer.h:
* Source/WebGPU/WebGPU/Buffer.mm:
(WebGPU::Buffer::getMappedRange):
(WebGPU::Buffer::size const):

Canonical link: https://commits.webkit.org/274591@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to