From: nasm-bot f. C. G. <gor...@gm...> - 2015-10-11 15:09:21
|
Commit-ID: 6377180e0873731f60a18fe5a61065f9c7795603 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=6377180e0873731f60a18fe5a61065f9c7795603 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 11 Oct 2015 17:57:04 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 11 Oct 2015 18:06:30 +0300 nasmlib: Plcate undefined behaviour in signed_bits http://bugzilla.nasm.us/show_bug.cgi?id=3392320 Reported-by: Dingbao Xie <xie...@gm...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- nasmlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nasmlib.h b/nasmlib.h index fb2bb08..a3a8c12 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; } |