Validate set_bind_group is within bounds of limit

This commit is contained in:
Connor Fitzgerald
2020-07-07 14:35:03 -04:00
parent cfd21d4913
commit f76b631961
3 changed files with 21 additions and 0 deletions

View File

@@ -528,6 +528,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
num_dynamic_offsets,
bind_group_id,
} => {
assert!(
(index as u32) < device.limits.max_bind_groups,
"Bind group index {0} is out of range 0..{1} provided by requested max_bind_group limit {1}",
index,
device.limits.max_bind_groups
);
let offsets = &base.dynamic_offsets[..num_dynamic_offsets as usize];
base.dynamic_offsets =
&base.dynamic_offsets[num_dynamic_offsets as usize..];

View File

@@ -157,6 +157,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
num_dynamic_offsets,
bind_group_id,
} => {
assert!(
(index as u32) < cmb.limits.max_bind_groups,
"Bind group index {0} is out of range 0..{1} provided by requested max_bind_group limit {1}",
index,
cmb.limits.max_bind_groups
);
let offsets = &base.dynamic_offsets[..num_dynamic_offsets as usize];
base.dynamic_offsets = &base.dynamic_offsets[num_dynamic_offsets as usize..];

View File

@@ -875,6 +875,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
num_dynamic_offsets,
bind_group_id,
} => {
assert!(
(index as u32) < device.limits.max_bind_groups,
"Bind group index {0} is out of range 0..{1} provided by requested max_bind_group limit {1}",
index,
device.limits.max_bind_groups
);
let offsets = &base.dynamic_offsets[..num_dynamic_offsets as usize];
base.dynamic_offsets = &base.dynamic_offsets[num_dynamic_offsets as usize..];