diff --git a/crates/spirv-std/src/byte_addressable_buffer.rs b/crates/spirv-std/src/byte_addressable_buffer.rs index 6faad4434e..f4c6dba491 100644 --- a/crates/spirv-std/src/byte_addressable_buffer.rs +++ b/crates/spirv-std/src/byte_addressable_buffer.rs @@ -71,7 +71,7 @@ fn bounds_check(data: &[u32], byte_index: u32) { panic!("`byte_index` should be a multiple of 4"); } let last_byte = byte_index + sizeof; - let len = data.len() as u32; + let len = data.len() as u32 * 4; if byte_index + sizeof > len { panic!( "index out of bounds: the len is {} but loading {} bytes at `byte_index` {} reads until {} (exclusive)",