From 422414aa87a6a1b3f45d1e1ca30e41c6e08d010c Mon Sep 17 00:00:00 2001 From: TomAwezome Date: Wed, 26 Oct 2022 19:26:54 -0400 Subject: [PATCH] Fix CheckPtr and CheckCodePtr missing else and return. --- src/Kernel/KDebug.ZC | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Kernel/KDebug.ZC b/src/Kernel/KDebug.ZC index 49c611af..4f08387c 100755 --- a/src/Kernel/KDebug.ZC +++ b/src/Kernel/KDebug.ZC @@ -1,13 +1,21 @@ Bool CheckPtr(U8 *ptr) {//Check if address is valid pointer. + CZXE *zxe = mem_boot_base - sizeof(CZXE); + if (mem_heap_base <= ptr <= mem_mapped_space) return *MemPageTable(ptr) & 1; + else + return mem_boot_base < ptr < mem_boot_base + zxe->file_size - 1 - sizeof(CZXE); } Bool CheckCodePtr(U8 *ptr) {//Check if address is valid code address. + CZXE *zxe = mem_boot_base - sizeof(CZXE); + if (mem_heap_base <= ptr <= mem_heap_limit) return *MemPageTable(ptr) & 1; + else + return mem_boot_base < ptr < mem_boot_base + zxe->file_size - 1 - sizeof(CZXE); } Bool CheckOnStack(U8 *ptr, CTask *task=NULL)