[webkit-changes] [WebKit/WebKit] 7fed86: Fix bounds check in Queue::writeBuffer when buffer...

Alex Christensen noreply at github.com
Wed Mar 6 12:53:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7fed8609a81438d9ae188d1b83db749dba59236d
      https://github.com/WebKit/WebKit/commit/7fed8609a81438d9ae188d1b83db749dba59236d
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2024-03-06 (Wed, 06 Mar 2024)

  Changed paths:
    A LayoutTests/fast/webgpu/write-to-destroyed-buffer-expected.txt
    A LayoutTests/fast/webgpu/write-to-destroyed-buffer.html
    M Source/WebGPU/WebGPU/BindGroup.mm
    M Source/WebGPU/WebGPU/Buffer.h
    M Source/WebGPU/WebGPU/Buffer.mm
    M Source/WebGPU/WebGPU/CommandEncoder.mm
    M Source/WebGPU/WebGPU/CommandsMixin.mm
    M Source/WebGPU/WebGPU/ComputePassEncoder.mm
    M Source/WebGPU/WebGPU/Queue.mm
    M Source/WebGPU/WebGPU/RenderBundleEncoder.mm
    M Source/WebGPU/WebGPU/RenderPassEncoder.mm

  Log Message:
  -----------
  Fix bounds check in Queue::writeBuffer when buffer has been destroyed
https://bugs.webkit.org/show_bug.cgi?id=270538
rdar://123811082

Reviewed by Mike Wyrzykowski.

Buffer::destroy updates m_buffer but didn't update m_size, and it shouldn't update the size as
seen by the JS API.

Instead of updating it, I derive the size from m_buffer and replace size() with currentSize()
and initialSize()

I also add a null check to avoid writing to a buffer that is null.

* LayoutTests/fast/webgpu/write-to-destroyed-buffer-expected.txt: Added.
* LayoutTests/fast/webgpu/write-to-destroyed-buffer.html: Added.
* Source/WebGPU/WebGPU/Buffer.h:
(WebGPU::Buffer::create):
* Source/WebGPU/WebGPU/Buffer.mm:
(WebGPU::Device::createBuffer):
(WebGPU::Buffer::Buffer):
(WebGPU::Buffer::getMappedRange):
(WebGPU::Buffer::errorValidatingMapAsync const):
(WebGPU::Buffer::mapAsync):
(WebGPU::Buffer::size const):
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::validateWriteBuffer const):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list