[webkit-changes] [WebKit/WebKit] e99d13: [WGSL] Add validation to integer modulo

Tadeu Zagallo noreply at github.com
Mon Nov 13 06:29:55 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e99d13b4e5e12d838104c09e3c3206a431314880
      https://github.com/WebKit/WebKit/commit/e99d13b4e5e12d838104c09e3c3206a431314880
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-11-13 (Mon, 13 Nov 2023)

  Changed paths:
    M Source/WebGPU/WGSL/ConstantFunctions.h
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/WGSLShaderModule.h
    A Source/WebGPU/WGSL/tests/invalid/modulo.wgsl

  Log Message:
  -----------
  [WGSL] Add validation to integer modulo
https://bugs.webkit.org/show_bug.cgi?id=264603
rdar://118239748

Reviewed by Mike Wyrzykowski.

Similar to division, we need to check for modulo with zero or
INT_MIN and -1.

* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::BINARY_OPERATION):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::emitNecessaryHelpers):
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::usesModulo const):
(WGSL::ShaderModule::setUsesModulo):
* Source/WebGPU/WGSL/tests/invalid/modulo.wgsl: Added.

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




More information about the webkit-changes mailing list