[Bug 191719] bin/expr doesn't detect some overflow errors with multiplication
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Jul 7 21:51:33 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191719
Jilles Tjoelker <jilles at FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|Needs Triage |Open
CC| |jilles at FreeBSD.org
--- Comment #2 from Jilles Tjoelker <jilles at 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.
More information about the freebsd-bugs
mailing list