[nasm:master] output: when converting OUT_SEGMENT to legacy, don't lose the addend

nasm-bot for H. Peter Anvin hpa at zytor.com
Wed Dec 7 10:54:07 PST 2022


Commit-ID:  cab5b75145466232cd6a8cfed46adc4b9d0483d8
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=cab5b75145466232cd6a8cfed46adc4b9d0483d8
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 7 Dec 2022 10:51:33 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 7 Dec 2022 10:51:33 -0800

output: when converting OUT_SEGMENT to legacy, don't lose the addend

When converting an OUT_SEGMENT relocation to legacy, the addend is
still significant, as it would represent an explicit addend to the
segment number.

Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392783
Reported-by: David Fifield <david at bamsoftware.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 output/legacy.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/output/legacy.c b/output/legacy.c
index d2785387..15d22e9e 100644
--- a/output/legacy.c
+++ b/output/legacy.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------- *
  *
- *   Copyright 2016-2017 The NASM Authors - All Rights Reserved
+ *   Copyright 2016-2022 The NASM Authors - All Rights Reserved
  *   See the file AUTHORS included with the NASM distribution for
  *   the specific copyright holders.
  *
@@ -89,10 +89,8 @@ void nasm_do_legacy_output(const struct out_data *data)
 
     case OUT_SEGMENT:
         type = OUT_ADDRESS;
-        dptr = zero_buffer;
-        size = (data->flags & OUT_SIGNED) ? -data->size : data->size;
         tsegment |= 1;
-        break;
+        /* fall through */
 
     case OUT_ADDRESS:
         dptr = &data->toffset;


More information about the Nasm-commits mailing list