Possible access violation for low host addresses
The function IsInMemoryRange checks the validity of a certain memory address by verifying if it falls under the allocated host space, however it doesn't correctly check for the first 4096 bytes, which are protected by VirtualProtect
Although I haven't seen a real scenario so far, this erroneous check can wrongly pass if the target address falls into the protected memory region, and as such any subsequent attempt to use the resulting pointer can end up into a segfault.
So far the function is used only twice in the code: here and here
That wasn't really the intent of this function, I came up with it while making the mod loader to ensure I didn't accidentally allocate memory in the host when I meant to do it in the guest memory range instead. It will crash immediately after anyway if an access in the protected region happens.