summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2015-10-11 17:57:04 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2015-10-11 18:06:30 +0300
commit6377180e0873731f60a18fe5a61065f9c7795603 (patch)
tree304a37453a8f8b65e6c3108b4f3609048dfc68e9
parentb0b969eec48d9800f34dc60bff21f6eee981d8fe (diff)
downloadnasm-6377180e0873731f60a18fe5a61065f9c7795603.tar.gz
nasmlib: Plcate undefined behaviour in signed_bits
http://bugzilla.nasm.us/show_bug.cgi?id=3392320 Reported-by: Dingbao Xie <xiedingbao@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--nasmlib.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/nasmlib.h b/nasmlib.h
index fb2bb084..a3a8c12a 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -456,7 +456,7 @@ static inline int64_t signed_bits(int64_t value, int bits)
if (bits < 64) {
value &= ((int64_t)1 << bits) - 1;
if (value & (int64_t)1 << (bits - 1))
- value |= (int64_t)-1 << bits;
+ value |= (int64_t)((uint64_t)-1 << bits);
}
return value;
}