News for hackers. Stuff that matters.
Re:IDIV DoS (INT_MIN / -1) by kevinnk on Sunday January 27, 2013 @07:46PM (#5126441)
The example the article gives isn't a general C problem, it's a common bug in some (mostly older) C/C++ compilers. As you point out GCC does not have this bug.
Re:IDIV DoS (INT_MIN / -1) by haberman on Sunday January 27, 2013 @08:43PM (#5126607)
It's not a bug, it's intended to be undefined behavior; see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html... (issue 1450)
Re:IDIV DoS (INT_MIN / -1) by mikeash on Sunday January 27, 2013 @08:46PM (#5126620)
Regardless of undefined behavior, it should not crash the compiler.
Re:IDIV DoS (INT_MIN / -1) by haberman on Sunday January 27, 2013 @09:12PM (#5126709)
Ah, I missed that it can crash the tcc compiler. Yeah, that's a bug.
Re:IDIV DoS (INT_MIN / -1) by mikeash on Monday January 28, 2013 @09:55AM (#5128691)
Probably easy to miss. One really does not expect the compiler to crash on code like that.