about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/custommem.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/custommem.c b/src/custommem.c
index c8f8db66..d96a38be 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -1224,6 +1224,7 @@ void updateProtection(uintptr_t addr, size_t size, uint32_t prot)
         uintptr_t bend;
         uint32_t oprot;
         rb_get_end(memprot, cur, &oprot, &bend);
+        if(bend>end) bend = end;
         uint32_t dyn=(oprot&PROT_DYN);
         if(!(dyn&PROT_NEVERPROT)) {
             if(dyn && (prot&PROT_WRITE)) {   // need to remove the write protection from this block