validate: check function argument type to be in range

This commit is contained in:
Dzmitry Malyshau committed 2022-01-14 12:44:27 -05:00
1 parent ee0cb0d5d3
commit fee69774a3
1 file changed
+8 -1
+8 -1
View File
@@ -837,7 +837,14 @@ impl super::Validator {
#[cfg(feature = "validate")]
for (index, argument) in fun.arguments.iter().enumerate() {
match module.types[argument.ty].inner.pointer_class() {
let ty = module.types.get_handle(argument.ty).ok_or(
FunctionError::InvalidArgumentType {
index,
name: argument.name.clone().unwrap_or_default(),
}
.with_span_handle(argument.ty, &module.types),
)?;
match ty.inner.pointer_class() {
Some(crate::StorageClass::Private)
| Some(crate::StorageClass::Function)
| Some(crate::StorageClass::WorkGroup)