summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bradshaw <mjbshaw@google.com>2018-11-21 11:03:13 -0800
committerCyrill Gorcunov <gorcunov@gmail.com>2018-11-23 23:51:16 +0300
commitfd143104694ff3d92a8639c2eaf42dabad79b64e (patch)
tree9b0a93e216691ad409188ea0ddac5b5e9c61f32f
parent7b6371b9d35705ee3800082ca245f8dd289bb216 (diff)
downloadnasm-fd143104694ff3d92a8639c2eaf42dabad79b64e.tar.gz
Fix undefined behavior when shifting left by 32 bits
See https://bugzilla.nasm.us/show_bug.cgi?id=3392368 Signed-off-by: Michael Bradshaw <mjbshaw@google.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--asm/float.c2
1 files changed, 1 insertions, 1 deletions
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)