Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e9d5f63ecb2ca601e84b1f0cc2c23f63c43d21c2
      
https://github.com/WebKit/WebKit/commit/e9d5f63ecb2ca601e84b1f0cc2c23f63c43d21c2
  Author: Tadeu Zagallo <tzaga...@apple.com>
  Date:   2023-01-27 (Fri, 27 Jan 2023)

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTShaderModule.h
    M Source/WebGPU/WGSL/Parser.cpp
    M Source/WebGPU/WGSL/Parser.h
    M Source/WebGPU/WGSL/ParserPrivate.h
    M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp

  Log Message:
  -----------
  [WGSL] Keep source alive for as long as AST is alive
https://bugs.webkit.org/show_bug.cgi?id=251204
<rdar://problem/104691207>

Reviewed by Myles C. Maxfield.

The `Identifier`s generated by the parser keep a reference and offset to the 
input source,
but no references are kept to make sure the source stays around, which resulted 
in it
being deallocated while the AST was still in use. I added a test that crashes 
if Guard Malloc
is enabled.

* Source/WebGPU/WGSL/AST/ASTShaderModule.h:
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::parse):
(WGSL::Parser<Lexer>::parseShader):
* Source/WebGPU/WGSL/Parser.h:
* Source/WebGPU/WGSL/ParserPrivate.h:
* Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp:
(TestWGSLAPI::TEST):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to