From 2367988301704881a61ca12c23eda9c385c43d3e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 2 Jun 2016 09:15:40 -0700 Subject: 3026 - integer overflow protection How did I not know about -ftrapv for so long?! Found while reading Memarian et al, "Into the depths of C: Elaborating the de facto standards". http://www.cl.cam.ac.uk/~pes20/cerberus/pldi16.pdf --- 001help.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '001help.cc') diff --git a/001help.cc b/001help.cc index 1b24f217..b8dbe7a6 100644 --- a/001help.cc +++ b/001help.cc @@ -96,8 +96,8 @@ bool is_equal(char* s, const char* lit) { :(before "End Includes") #define SIZE(X) (assert((X).size() < (1LL<<(sizeof(int)*8-2))), static_cast((X).size())) //: -//: 5. Integer overflow is still impossible to guard against. Maybe after -//: reading http://www.cs.utah.edu/~regehr/papers/overflow12.pdf +//: 5. Integer overflow is guarded against at runtime using the -ftrapv flag +//: to the compiler, supported by both GCC and LLVM. //: //: 6. Map's operator[] being non-const is fucking evil. :(before "Globals") // can't generate prototypes for these -- cgit 1.4.1-2-gfad0