aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-16 01:42:26 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-16 01:44:49 -0700
commit2586cee21dfc45c24b1bec47c0e0f7ddfae3dca8 (patch)
tree99cb5569a3f50a20e5d50105a4142791c872bd69
parent7be54b3d0c94e1be0f420bd504aaef1bc7d94155 (diff)
downloadnasm-2586cee21dfc45c24b1bec47c0e0f7ddfae3dca8.tar.gz
nasm-2586cee21dfc45c24b1bec47c0e0f7ddfae3dca8.tar.xz
nasm-2586cee21dfc45c24b1bec47c0e0f7ddfae3dca8.zip
BR 3392472: don't complain on wraparound for lower bit modes
If the address we are using is >= the size of the instruction, then don't complain on overflow as we can wrap around the top and bottom of the address space just fine. Alternatively we could downgrade it to OUT_WRAP in that case. Reported-by: C. Masloch <pushbx@38.de> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--asm/assemble.c3
-rw-r--r--test/br3392472.asm12
2 files changed, 14 insertions, 1 deletions
diff --git a/asm/assemble.c b/asm/assemble.c
index e24ebdb5..2394e765 100644
--- a/asm/assemble.c
+++ b/asm/assemble.c
@@ -376,7 +376,8 @@ static void out(struct out_data *data)
amax = ofmt->maxbits >> 3; /* Maximum address size in bytes */
if ((ofmt->flags & OFMT_KEEP_ADDR) == 0 && data->tsegment == fixseg &&
data->twrt == NO_SEG) {
- warn_overflow_out(addrval, asize, data->sign);
+ if (asize < (data->bits >> 3))
+ warn_overflow_out(addrval, asize, data->sign);
xdata.q = cpu_to_le64(addrval);
data->data = xdata.b;
data->type = OUT_RAWDATA;
diff --git a/test/br3392472.asm b/test/br3392472.asm
new file mode 100644
index 00000000..7f326eaa
--- /dev/null
+++ b/test/br3392472.asm
@@ -0,0 +1,12 @@
+org 0
+%ifndef SEEK
+ %define SEEK 0
+%endif
+times SEEK - ($ - $$) nop
+jmp near init
+
+%ifndef NUM
+ %define NUM 9956h
+%endif
+times NUM - ($ - $$) db 0
+init: