-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fault on zero page memory addresses #23
Comments
One reason I couldn't make Mem blanket disallow accesses <0x1000 is that we currently use sub-slices of Mem where accesses <0x1000 are valid. This is another issue that might be helped by the idea in #26 , by making it so it's always an error for Mem to access <0x1000 as you have in is_oob above. |
After some of the fixes from #26 I tried this, which makes anything that creates a pointer <4k crash, and it successfully reproduced the issue in #28 while still letting BasicDD work. --- a/memory/src/mem.rs
+++ b/memory/src/mem.rs
@@ -117,7 +117,7 @@ impl<'m> Mem<'m> {
}
pub fn is_oob<T>(&self, addr: u32) -> bool {
- self.ptr as usize + addr as usize + size_of::<T>() > self.end as usize
+ addr < 0x1000 || self.ptr as usize + addr as usize + size_of::<T>() > self.end as usize
} |
New blockers are functions like retrowin32/win32/src/winapi/ucrtbase.rs Line 49 in ce12d36
|
Right now, retrowin32 allows reads and writes to memory addresses < 0x1000 without complaint. This can hide or obfuscate bugs that would normally result in crashes. This affects both
x86-emu
andx86-unicorn
.This is definitely not the right approach, but here's what I did in order to track down invalid memory r/w using
x86-emu
:The text was updated successfully, but these errors were encountered: