-
Notifications
You must be signed in to change notification settings - Fork 329
Description
(Edited: bold the proposal)
Proposal
Currently WebGPU Spec use USVString
and DOMSrting
in several places (listed below) including user input.
For both type a string with a null character '\0'
(i.e. Unicode code point U+0000) in it is valid, e.g. "abc\0xyz"
would be valid DOMString
and USVString
, however such kind of strings is kind of tricky in other languages like C/C++.
Currently the WGSL spec explicitly forbid the null code point (U+0000) in WGSL program. Although using a string with '\0'
in it in some case like entryPoint
should be a validation error (since there must not be a WGSL entry point name containing '\0'
), it may be generally better and easier to forbid any '\0'
in all string user providing to WebGPU. It would be coherent to report a JavaScript TypeError whenever any user-provided string was found to contain a '\0'
.
I am not quite sure how to introduce such rule into WebGPU spec, considering USVString
and DomString
are used multiple times in different places within the spec. Maybe add a small sub-chapter under Chapter 3. Fundamentals?
Current usage
Currently USVString
and DomString
are used in WebGPU spec for:
- USVString
label
inGPUObjectBase
code
andhints
inGPUShaderModuleDescriptor
entryPoint
andconstants
inGPUProgrammableStage
groupLabel
forpushDebugGroup
andmarkerLabel
forinsertDebugMarker
inGPUDebugCommandsMixin
- DOMString
- Some read-only attributes
- parameter
unmaskHints
of requestAdapterInfo requiredLimits
inGPUDeviceDescriptor
message
of constructors for different GPUError subtypes, e.g. GPUValidationErrortype
of constructors forGPUUncapturedErrorEvent