Skip to content

Commit

Permalink
fix memory id in limit_resource (#67)
Browse files Browse the repository at this point in the history
* fix memory id in limit_resource

* bump version
  • Loading branch information
chenyan-dfinity committed Aug 27, 2024
1 parent c5217c7 commit c943973
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ic-wasm"
version = "0.8.2"
version = "0.8.3"
authors = ["DFINITY Stiftung"]
edition = "2021"
description = "A library for performing Wasm transformations specific to canisters running on the Internet Computer"
Expand Down
13 changes: 7 additions & 6 deletions src/limit_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,14 @@ pub fn limit_resource(m: &mut Module, config: &Config) {
}

fn limit_heap_memory(m: &mut Module, limit: u32) {
let memory_id = m.get_memory_id().expect("unable to get memory id");
let memory = m.memories.get_mut(memory_id);
let limit = limit as u64;
if memory.initial > limit {
memory.initial = limit
if let Ok(memory_id) = m.get_memory_id() {
let memory = m.memories.get_mut(memory_id);
let limit = limit as u64;
if memory.initial > limit {
memory.initial = limit
}
memory.maximum = Some(limit);
}
memory.maximum = Some(limit);
}

fn make_cycles_add128(m: &mut Module) -> FunctionId {
Expand Down

0 comments on commit c943973

Please sign in to comment.