Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions core/shared/mem-alloc/ems/ems_kfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ gc_migrate(gc_handle_t handle, char *pool_buf_new, gc_size_t pool_buf_size)
while (cur < end) {
size = hmu_get_size(cur);

#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
if (size <= 0 || size > (uint32)((uint8 *)end - (uint8 *)cur)) {
LOG_ERROR("[GC_ERROR]Heap is corrupted, heap migrate failed.\n");
#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
heap->is_heap_corrupted = true;
#endif
return GC_ERROR;
}
#endif

if (hmu_get_ut(cur) == HMU_FC && !HMU_IS_FC_NORMAL(size)) {
tree_node = (hmu_tree_node_t *)cur;
Expand All @@ -315,15 +315,13 @@ gc_migrate(gc_handle_t handle, char *pool_buf_new, gc_size_t pool_buf_size)
cur = (hmu_t *)((char *)cur + size);
}

#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
if (cur != end) {
LOG_ERROR("[GC_ERROR]Heap is corrupted, heap migrate failed.\n");
#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
heap->is_heap_corrupted = true;
#endif
return GC_ERROR;
}
#else
bh_assert(cur == end);
#endif

return 0;
}
Expand Down
Loading