{"id":6907,"date":"2013-01-30T16:18:42","date_gmt":"2013-01-30T21:18:42","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=6907"},"modified":"2013-01-30T16:18:43","modified_gmt":"2013-01-30T21:18:43","slug":"detecting-overflows-undefined-behaviour-and-other-nasties","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2013\/01\/30\/detecting-overflows-undefined-behaviour-and-other-nasties\/","title":{"rendered":"Detecting Overflows, Undefined Behaviour and Other Nasties"},"content":{"rendered":"<p><a href=\"http:\/\/blog.securemacprogramming.com\/2013\/01\/detecting-overflows-undefined-behaviour-and-other-nasties\/\">Graham Lee<\/a>:<\/p>\n<blockquote cite=\"http:\/\/blog.securemacprogramming.com\/2013\/01\/detecting-overflows-undefined-behaviour-and-other-nasties\/\"><p>Coming up in a future release of clang is a <a href=\"http:\/\/clang.llvm.org\/docs\/UsersManual.html#controlling-code-generation\">collection of sanitisers<\/a> that insert runtime checks for the things described above. If you&rsquo;re the kind of person who writes assertions like the above in your code, you can swap all that for sanitisers enabled in your debug builds. If you&rsquo;re not the kind of person who writes those assertions, you probably should enable these sanitisers, then go and find out where else you should be adding assertions.<\/p><\/blockquote>\n<p>For example, <code>-fsanitize=integer<\/code> will print a runtime error if you add two integers and the result would overflow <code>int<\/code>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Graham Lee: Coming up in a future release of clang is a collection of sanitisers that insert runtime checks for the things described above. If you&rsquo;re the kind of person who writes assertions like the above in your code, you can swap all that for sanitisers enabled in your debug builds. If you&rsquo;re not the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[45,230,255,71],"class_list":["post-6907","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-c","tag-clang","tag-compiler","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=6907"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6907\/revisions"}],"predecessor-version":[{"id":6908,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6907\/revisions\/6908"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=6907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=6907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=6907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}