From c75a0a41bdf7c91654ea26784f568cf80aa5260c Mon Sep 17 00:00:00 2001 From: Peter Johnson <peter@tortall.net> Date: Mon, 24 Jan 2005 06:21:16 +0000 Subject: [PATCH] * nasm-listfmt.c (nasm_listfmt_output_expr): Fix garbage due to non-simple expressions by outputting a 0 if the expr does not have an intnum equivalent. This is not a fix: the real fix will need to be changing how listfmts get the final data bytes for a bytecode. This "fix" only replaces the garbage with 0's, not the correct value (e.g. for relative jumps). Found by: Albrecht Kleine <kleine@ak.sax.de> svn path=/trunk/yasm/; revision=1196 --- modules/listfmts/nasm/nasm-listfmt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/listfmts/nasm/nasm-listfmt.c b/modules/listfmts/nasm/nasm-listfmt.c index 45ecf59e..0bde6a95 100644 --- a/modules/listfmts/nasm/nasm-listfmt.c +++ b/modules/listfmts/nasm/nasm-listfmt.c @@ -123,6 +123,14 @@ nasm_listfmt_output_expr(yasm_expr **ep, unsigned char *buf, size_t destsize, if (intn) return yasm_arch_intnum_tobytes(info->arch, intn, buf, destsize, valsize, shift, bc, 0, bc->line); + else { + int retval; + intn = yasm_intnum_create_uint(0); + retval = yasm_arch_intnum_tobytes(info->arch, intn, buf, destsize, + valsize, shift, bc, 0, bc->line); + yasm_intnum_destroy(intn); + return retval; + } return 0; } -- 2.40.0