:: commit 89321360df60febebb886a0255276d152eea4c58

Mintsuki <mintsuki@protonmail.com> — 2026-02-07 05:40

parents: 869287f343

lib/elf: Fix relocation bounds check overflow for large r_addr values

diff --git a/common/lib/elf.c b/common/lib/elf.c
index f983495c..3514c651 100644
--- a/common/lib/elf.c
+++ b/common/lib/elf.c
@@ -487,7 +487,7 @@ end_of_pt_segment:
             continue;
 
         // Relocation is after buffer
-        if (vaddr + size < relocation->r_addr + 8)
+        if (size < 8 || relocation->r_addr > vaddr + size - 8)
             continue;
 
         // It's inside it, calculate where it is
tab: 248 wrap: offon