Date: Mon, 07 Jul 2014 21:51:34 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 191719] bin/expr doesn't detect some overflow errors with multiplication Message-ID: <bug-191719-8-NiwnFbGnqK@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-191719-8@https.bugs.freebsd.org/bugzilla/> References: <bug-191719-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191719 Jilles Tjoelker <jilles@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Triage |Open CC| |jilles@FreeBSD.org --- Comment #2 from Jilles Tjoelker <jilles@FreeBSD.org> --- All the overflow checks except for division and modulo are fundamentally broken because they first let overflow happen and then attempt to check for it. Since signed integer overflow is undefined behaviour, this allows the compiler to optimize the overflow checks away, or worse. Also, INTMAX_MIN modulo -1 causes SIGFPE on amd64, like expr -e -- $((-0x7fffffffffffffff - 1)) % -1 Either op_rem() should not sabotage assert_div()'s check or op_rem() should return a zero-valued integer for anything modulo -1. -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-191719-8-NiwnFbGnqK>