[webkit-changes] [WebKit/WebKit] a59c22: [WebGPU] GPUShaderModule.getCompilationInfo crashes

mwyrzykowski noreply at github.com
Tue Oct 31 10:52:01 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a59c221d09e9f89a0f3ab013e96fc9ebe33cbd80
      https://github.com/WebKit/WebKit/commit/a59c221d09e9f89a0f3ab013e96fc9ebe33cbd80
  Author: Mike Wyrzykowski <mwyrzykowski at apple.com>
  Date:   2023-10-31 (Tue, 31 Oct 2023)

  Changed paths:
    M Source/WebCore/Modules/WebGPU/Implementation/WebGPUShaderModuleImpl.cpp
    M Source/WebGPU/WebGPU/ShaderModule.mm
    M Source/WebGPU/WebGPU/WebGPU.h

  Log Message:
  -----------
  [WebGPU] GPUShaderModule.getCompilationInfo crashes
https://bugs.webkit.org/show_bug.cgi?id=263951
<radar://117723027>

Reviewed by Tadeu Zagallo.

Fix improper string lifetime usage which was resulting in crashes due to
C-types storing pointers to strings which had been deallocated.

Move types from char* to WTF::String to avoid these issues in general.

* Source/WebCore/Modules/WebGPU/Implementation/WebGPUShaderModuleImpl.cpp:
(WebCore::WebGPU::ShaderModuleImpl::compilationInfo):
Type is now a String.

* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::CompilationMessageData::CompilationMessageData):
There is no need to do this asynchronously, the specification does not require that
and we weren't properly cloning the data over the async call.

(WebGPU::convertMessages):
This code was building a vector which gets returned and storing pointers, which
doesn't work in general.
(WebGPU::ShaderModule::getCompilationInfo):

* Source/WebGPU/WebGPU/WebGPU.h:
Store WTF::String instead of raw pointer to char.

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




More information about the webkit-changes mailing list