]> granicus.if.org Git - yasm/commitdiff
* nasm-listfmt.c (nasm_listfmt_output_expr): Fix garbage due to non-simple
authorPeter Johnson <peter@tortall.net>
Mon, 24 Jan 2005 06:21:16 +0000 (06:21 -0000)
committerPeter Johnson <peter@tortall.net>
Mon, 24 Jan 2005 06:21:16 +0000 (06:21 -0000)
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

index 45ecf59ee11d32e7cfbae3f9b6785ce841fb1d58..0bde6a95330256fc5479c4fa15a112472c649677 100644 (file)
@@ -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;
 }