From f000951fc970708bfa0dd5d357a334b8cfc41eb0 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 10 Jul 2021 17:42:20 +0200 Subject: Fixed some issue with memory protection tracking --- src/custommem.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/custommem.c b/src/custommem.c index 8cd15f21..8424ea1b 100644 --- a/src/custommem.c +++ b/src/custommem.c @@ -708,11 +708,12 @@ void protectDBnolock(uintptr_t addr, uintptr_t size) } const uintptr_t ii = i&(MEMPROT_SIZE-1); uint8_t prot = kh_value(memprot, k)[ii]; - if(!prot) - prot = PROT_READ | PROT_WRITE; // comes from malloc & co, so should not be able to execute - kh_value(memprot, k)[ii] = prot|PROT_DYNAREC; - if(!(prot&PROT_DYNAREC)) + if(!(prot&PROT_DYNAREC)) { + if(!prot) + prot = PROT_READ | PROT_WRITE; // comes from malloc & co, so should not be able to execute + kh_value(memprot, k)[ii] = prot|PROT_DYNAREC; mprotect((void*)(i<