diff --git a/runtime/wasm/src/asc_abi/class.rs b/runtime/wasm/src/asc_abi/class.rs index 133e789e95c..f65ff3a47a6 100644 --- a/runtime/wasm/src/asc_abi/class.rs +++ b/runtime/wasm/src/asc_abi/class.rs @@ -55,6 +55,17 @@ impl ArrayBuffer { fn get(&self, byte_offset: u32, length: u32) -> Result, DeterministicHostError> { let length = length as usize; let byte_offset = byte_offset as usize; + + self.content[byte_offset..] + .chunks(size_of::()) + .take(length) + .map(T::from_asc_bytes) + .collect() + + // TODO: This code is preferred as it validates the length of the array. + // But, some existing subgraphs were found to break when this was added. + // This needs to be root caused + /* let range = byte_offset..byte_offset + length * size_of::(); self.content .get(range) @@ -64,6 +75,7 @@ impl ArrayBuffer { .chunks_exact(size_of::()) .map(|bytes| T::from_asc_bytes(bytes)) .collect() + */ } }