From 66312f55ddb6ac53ec80d116ebfde1f33b83f60c Mon Sep 17 00:00:00 2001 From: Rangi Date: Mon, 13 Jul 2026 13:16:49 -0400 Subject: [PATCH] Avoid unsigned overflow/truncation from bad offset values in invalid object files --- src/link/patch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/link/patch.cpp b/src/link/patch.cpp index e1ea336c..d7befd52 100644 --- a/src/link/patch.cpp +++ b/src/link/patch.cpp @@ -550,7 +550,7 @@ static void applyFilePatches(Section §ion, Section &dataSection) { verbosePrint(VERB_INFO, "Patching section \"%s\"...\n", section.name.c_str()); for (Patch &patch : section.patches) { int32_t value = computeRPNExpr(patch, *section.fileSymbols); - uint16_t offset = patch.offset + section.offset; + uint32_t offset = patch.offset + section.offset; uint8_t typeSizes[PATCHTYPE_INVALID] = { 1, // PATCHTYPE_BYTE