Extra Defensive Measures

If you use gcc, you can compile with the -ftrapv option. This catches signed integer overflows by calling into various run-time functions, but it works only for signed integers. The other bit of bad news is these functions call abort() on overflow.

Microsoft Visual C++ 2005 automatically catches calls to operator new that overflow. Note, your code must catch the ensuing std::bad_alloc exception, or your application will crash.



19 Deadly Sins of Software Security. Programming Flaws and How to Fix Them
Writing Secure Code
ISBN: 71626751
EAN: 2147483647
Year: 2003
Pages: 239

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net