Fix memory tracing.

This commit is contained in:
Tomasz Drwięga
2017-08-26 21:53:41 +02:00
parent b6024adf85
commit dd3b6d49ee
2 changed files with 20 additions and 9 deletions

View File

@@ -44,7 +44,7 @@ pub trait Memory {
}
/// Checks whether offset and size is valid memory range
fn is_valid_range(off: usize, size: usize) -> bool {
pub fn is_valid_range(off: usize, size: usize) -> bool {
// When size is zero we haven't actually expanded the memory
let overflow = off.overflowing_add(size).1;
size > 0 && !overflow