From 69ed82447a13a22e52a86a51a5657c7955a6767b Mon Sep 17 00:00:00 2001 From: "Chang S. Bae" Date: Wed, 2 May 2018 08:07:51 -0700 Subject: output: macho -- Check the actual size of 64-bit absolute address Even though the size is set to 64-bit, actual value can be in 32-bit range. In that case, the use of such absolute address is prevented. The side effect of 58d2ab17 is resolved. https://bugzilla.nasm.us/show_bug.cgi?id=3392468 Reported-by: Richard Russell Reported-by: Michael Petch Signed-off-by: Chang S. Bae Signed-off-by: Cyrill Gorcunov --- output/outmacho.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/output/outmacho.c b/output/outmacho.c index 266a3dd1..a92b9ecc 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -670,7 +670,8 @@ static void macho_output(int32_t secto, const void *data, nasm_error(ERR_NONFATAL, "Mach-O format does not support" " section base references"); } else if (wrt == NO_SEG) { - if (fmt.ptrsize == 8 && asize != 8) { + if (fmt.ptrsize == 8 && + (asize != 8 || addr <= UINT32_MAX)) { nasm_error(ERR_NONFATAL, "Mach-O 64-bit format does not support" " 32-bit absolute addresses"); -- cgit v1.2.1