Skip to content

Commit 758c729

Browse files
authored
Fix a list length calculation in FACT-generated adapters (#12882)
This fixes a calculation when the source memory and destination memory have different pointer sizes. A typo meant that the destination byte length used the source byte length by accident instead of the source length. This isn't actually reachable at all in wasm today because memory64 isn't available at this time for components. FACT was originally written with memory64 support, however, to be a bit more future-proof and the component model may be getting memory64 support soon. For now though there's no test for this, just a minor update.
1 parent 5d52f56 commit 758c729

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/environ/src/fact/trampoline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2564,7 +2564,7 @@ impl<'a, 'b> Compiler<'a, 'b> {
25642564
} else if src_mem_opts.ptr() == dst_mem_opts.ptr() {
25652565
self.calculate_list_byte_len(dst_mem_opts, src_len.idx, dst_element_size)
25662566
} else {
2567-
self.convert_src_len_to_dst(src_byte_len.idx, src_mem_opts.ptr(), dst_mem_opts.ptr());
2567+
self.convert_src_len_to_dst(src_len.idx, src_mem_opts.ptr(), dst_mem_opts.ptr());
25682568
let tmp = self.local_set_new_tmp(dst_mem_opts.ptr());
25692569
let ret = self.calculate_list_byte_len(dst_mem_opts, tmp.idx, dst_element_size);
25702570
self.free_temp_local(tmp);

0 commit comments

Comments
 (0)