<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Jul 30, 2013, at 7:46 AM, Sean McBride <<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>> wrote:<br><div><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, 30 Jul 2013 07:00:52 -0400, Jeffrey Walton said:<br><blockquote type="cite">I'm testing a crypto library under the sanitizers. Crypto libraries<br>are notorious for doing clever (and sometimes undefined) things to<br>integers.<br><br>I'm catching a number of errors similar to below. Is (or should)<br>unsigned wrap be an error condition? I thought it was implementation<br>defined. Or is -fsanitize=integer catching signed integer overflow<br>(which is undefined behavior) and incorrectly reporting it?<br></blockquote><br>Unsigned wrapping is well-defined.  See here:<span class="Apple-converted-space"> </span><br><<a href="http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation">http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation</a>><br><br>Notice for "-fsanitize=integer" they say "Enables checks for undefined or suspicious integer behavior."  The 'suspicious' part refers to unsigned overflow, which, though well-defined, is often unexpected (though probably not in a crypto lib).<br></div></blockquote><div><br></div></div>Right.  Specifically, the class of security bugs where the calculation of an<div>allocation size overflows overwhelmingly involves unsigned overflow.</div><div>But of course there are also many reasonable calculations, like hash</div><div>functions, that should ignore unsigned overflow.  So it’s important for</div><div>the user to provide direction here.</div><div><br></div><div>John.</div></body></html>