Fix access to VMMemoryDefinition::current_length on big-endian (#3013)

The current_length member is defined as "usize" in Rust code,
but generated wasm code refers to it as if it were "u32".
While this happens to mostly work on little-endian machines
(as long as the length is < 4GB), it will always fail on
big-endian machines.

Fixed by making current_length "u32" in Rust as well, and
ensuring the actual memory size is always less than 4GB.
This commit is contained in:
Ulrich Weigand
2021-06-23 18:45:32 +02:00
committed by GitHub
parent b8c0ac72f1
commit 83007b79e3
7 changed files with 35 additions and 16 deletions

View File

@@ -203,7 +203,7 @@ pub struct VMMemoryDefinition {
pub base: *mut u8,
/// The current logical size of this linear memory in bytes.
pub current_length: usize,
pub current_length: u32,
}
#[cfg(test)]