:: commit f1adebea0d6eb45eb0de90c021106194f522ba95

Mintsuki <mintsuki@protonmail.com> — 2026-02-08 06:11

parents: 6b14238fc8

lib/elsewhere: Reject allocations above 4 GiB

diff --git a/common/lib/elsewhere.c b/common/lib/elsewhere.c
index 58ab247b..67d63f8b 100644
--- a/common/lib/elsewhere.c
+++ b/common/lib/elsewhere.c
@@ -41,6 +41,11 @@ retry:
     for (size_t i = 0; i < *ranges_count; i++) {
         uint64_t t_top = *target + t_length;
 
+        // Ensure allocation stays within 32-bit address space.
+        if (t_top > 0x100000000) {
+            return false;
+        }
+
         // Does it overlap with other elsewhere ranges targets?
         {
             uint64_t base = ranges[i].target;
tab: 248 wrap: offon