Skip to content

Commit 77d30b2

Browse files
committed
Fix bounds checking for memory grow AoT mode
1 parent 81e1a31 commit 77d30b2

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

core/iwasm/common/wasm_memory.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,7 @@ wasm_enlarge_memory_internal(WASMModuleInstance *module, uint32 inc_page_count,
791791
if (is_mmap) {
792792
LOG_VERBOSE("NOTE: Enlarging memory with mmap syscall by %d pages", inc_page_count);
793793
/*** Added for WALI ***/
794-
uint32 inc_bytes = num_bytes_per_page * inc_page_count;
795-
memory->num_bytes_per_page = num_bytes_per_page;
796-
memory->cur_page_count += inc_page_count;
797-
memory->max_page_count = max_page_count;
798-
memory->memory_data_size += inc_bytes;
799-
memory->memory_data_end += inc_bytes;
800-
return true;
794+
goto set_bound_check;
801795
/* */
802796
}
803797
LOG_ERROR("NOTE: Enlarging memory without mmap... There might be errors here..");
@@ -862,6 +856,7 @@ wasm_enlarge_memory_internal(WASMModuleInstance *module, uint32 inc_page_count,
862856
#endif
863857
}
864858

859+
set_bound_check:
865860
memory->num_bytes_per_page = num_bytes_per_page;
866861
memory->cur_page_count = total_page_count;
867862
memory->max_page_count = max_page_count;

0 commit comments

Comments
 (0)