From 453da7f33d3feb3b3079de9274219f80e3d34109 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 4 Nov 2024 21:46:10 -0500 Subject: Fix undefined behavior with COFF relocations Was causing major instability with WARP signature generation --- arch/x86/arch_x86.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- cgit v1.3.1