Skip to content

Commit a1af4e7

Browse files
authored
Fix FACT bounds check for custom-page-sizes (#13059)
This was originally included in #12972 but was accidentally lost during the refactorings of #13027. This re-adds it back in.
1 parent 42266d4 commit a1af4e7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

crates/environ/src/fact/trampoline.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,14 +3750,15 @@ impl<'a, 'b> Compiler<'a, 'b> {
37503750

37513751
self.instruction(Block(BlockType::Empty));
37523752
self.instruction(Block(BlockType::Empty));
3753+
let (memory, ty) = mem_opts.memory.unwrap();
37533754

37543755
// Calculate the full byte size of memory with `memory.size`. Note that
37553756
// arithmetic here is done always in 64-bits to accommodate 4G memories.
37563757
// Additionally it's assumed that 64-bit memories never fill up
37573758
// entirely.
3758-
self.instruction(MemorySize(mem_opts.memory.unwrap().0.as_u32()));
3759+
self.instruction(MemorySize(memory.as_u32()));
37593760
extend_to_64(self);
3760-
self.instruction(I64Const(16));
3761+
self.instruction(I64Const(ty.page_size_log2.into()));
37613762
self.instruction(I64Shl);
37623763

37633764
// Calculate the end address of the string. This is done by adding the

0 commit comments

Comments
 (0)