Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: efa18a80971b68a125ee0cb012ed5a76992ea8da
https://github.com/WebKit/WebKit/commit/efa18a80971b68a125ee0cb012ed5a76992ea8da
Author: Tadeu Zagallo <[email protected]>
Date: 2026-04-24 (Fri, 24 Apr 2026)
Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WGSL/MetalCompilationTests.mm
A Tools/TestWebKitAPI/Tests/WGSL/shaders/fuzz-166715941.wgsl
Log Message:
-----------
[WGSL] HashMap modified while iterating in GlobalVariableRewriter
https://bugs.webkit.org/show_bug.cgi?id=305386
rdar://166715941
Reviewed by Mike Wyrzykowski.
As part of the global variable rewriting, we thread global variables through
call sites all the way to the entrypoint. On top of that, we determined which
buffers need their length passed around, as if it was a global variable (this
is used for `arrayLength(x)`). However, while propagating the list of length
parameters from the callee to its callers, we mutated the hashmap while
iterating
it. In order to avoid that, while iterating we store the new entries into a
separate vector, and once the iteration has finished the HashMap is safely
updated.
Tests: Tools/TestWebKitAPI/Tests/WGSL/shaders/fuzz-166715941.wgsl
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visitCallee):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WGSL/MetalCompilationTests.mm:
(TestWGSLAPI::TEST_F(WGSLMetalCompilationTests, FuzzerTests)):
* Tools/TestWebKitAPI/Tests/WGSL/shaders/fuzz-166715941.wgsl: Added.
Originally-landed-as: 305413.53@safari-7624-branch (cc942caf40b2).
rdar://173969274
Canonical link: https://commits.webkit.org/311928@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications