From 7b6371b9d35705ee3800082ca245f8dd289bb216 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin (Intel)" Date: Tue, 20 Nov 2018 10:56:57 -0800 Subject: [PATCH 1/2] BR 3392529: if the default output name is the same as input -> nasm.out If no output filename is specified, then a default filename is used based on the input filename. If that ends up the *same* as the input filename, change the output filename to "nasm.out". Signed-off-by: H. Peter Anvin (Intel) --- asm/nasm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index bf0720a3..41a26649 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -514,9 +514,14 @@ int main(int argc, char **argv) * is a preprocess mode, we're perfectly * fine to output into stdout. */ - if (!outname) { - if (!(operating_mode & OP_PREPROCESS)) - outname = filename_set_extension(inname, ofmt->extension); + if (!outname && !(operating_mode & OP_PREPROCESS)) { + outname = filename_set_extension(inname, ofmt->extension); + if (!strcmp(outname, inname)) { + outname = "nasm.out"; + nasm_error(ERR_WARNING, + "default output file same as input, using `%s' for output\n", + inname, outname); + } } depend_ptr = (depend_file || (operating_mode & OP_DEPEND)) From fd143104694ff3d92a8639c2eaf42dabad79b64e Mon Sep 17 00:00:00 2001 From: Michael Bradshaw Date: Wed, 21 Nov 2018 11:03:13 -0800 Subject: [PATCH 2/2] Fix undefined behavior when shifting left by 32 bits See https://bugzilla.nasm.us/show_bug.cgi?id=3392368 Signed-off-by: Michael Bradshaw Signed-off-by: Cyrill Gorcunov --- asm/float.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/float.c b/asm/float.c index 37f5585a..7d313a59 100644 --- a/asm/float.c +++ b/asm/float.c @@ -556,7 +556,7 @@ static bool ieee_flconvert_bin(const char *string, int bits, mp = &mult[MANT_LIMBS]; /* Guard slot */ ms += LIMB_BITS; } - *mp |= v << ms; + *mp |= v << (ms % (sizeof(fp_limb) * CHAR_BIT)); ms -= bits; if (!seendot)