summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChang S. Bae <chang.seok.bae@intel.com>2018-05-02 08:07:51 -0700
committerCyrill Gorcunov <gorcunov@gmail.com>2018-05-05 23:43:57 +0300
commit69ed82447a13a22e52a86a51a5657c7955a6767b (patch)
tree21a254e5eff11164eb7ce053054ead7810938945
parent713fd1ffc82344f58a4ef94506a62c8e32704a2f (diff)
downloadnasm-69ed82447a13a22e52a86a51a5657c7955a6767b.tar.gz
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 <rtrussell@gmail.com> Reported-by: Michael Petch <mpetch@capp-sysware.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--output/outmacho.c3
1 files changed, 2 insertions, 1 deletions
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");