summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-11-04 21:46:10 -0500
committerMason Reed <mason@vector35.com>2024-11-04 21:46:10 -0500
commit453da7f33d3feb3b3079de9274219f80e3d34109 (patch)
treed2a9863031ee22ef5e3c254fed756979de7ba4b9
parent62f2dd7c6c89ca44f2096f535962b63f26f57730 (diff)
Fix undefined behavior with COFF relocations
Was causing major instability with WARP signature generation
-rw-r--r--arch/x86/arch_x86.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/arch_x86.cpp b/arch/x86/arch_x86.cpp
index 26e7cf27..8c446972 100644
--- a/arch/x86/arch_x86.cpp
+++ b/arch/x86/arch_x86.cpp
@@ -4489,11 +4489,12 @@ public:
// Note: info.base contains preferred base address and the base where the image is actually loaded
(void)view;
(void)arch;
- (void)len;
uint64_t* data64 = (uint64_t*)dest;
uint32_t* data32 = (uint32_t*)dest;
uint16_t* data16 = (uint16_t*)dest;
auto info = reloc->GetInfo();
+ if (len < info.size)
+ return false;
uint64_t offset = 0;
if (info.pcRelative)