Skip to content

Commit 0993601

Browse files
authored
Add check for stack_min_addr in bound check with hardware trap (#1166)
Add return value check for os_thread_get_stack_boundary before touch_pages in the initialization of memory access bound check with hardware trap.
1 parent 3d1dad7 commit 0993601

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/shared/platform/common/posix/posix_thread.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ init_stack_guard_pages()
411411
uint32 guard_page_count = STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT;
412412
uint8 *stack_min_addr = os_thread_get_stack_boundary();
413413

414+
if (stack_min_addr == NULL)
415+
return false;
416+
414417
/* Touch each stack page to ensure that it has been mapped: the OS
415418
may lazily grow the stack mapping as a guard page is hit. */
416419
(void)touch_pages(stack_min_addr, page_size);

0 commit comments

Comments
 (0)