<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Thanks. Fixed in r185437.</div><br><div><div>On Jul 1, 2013, at 7:37 PM, Eli Friedman <<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: 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;"><div dir="ltr">On Mon, Jul 1, 2013 at 4:54 PM, Michael Gottesman<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:mgottesman@apple.com" target="_blank">mgottesman@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Author: mgottesman<br>Date: Mon Jul  1 18:54:08 2013<br>New Revision: 185397<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=185397&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=185397&view=rev</a><br>Log:<br>[APFloat] Ensure that we can properly parse strings that do not have null terminators.<br><br><a href="rdar://14323230">rdar://14323230</a><br><br>Modified:<br>   <span class="Apple-converted-space"> </span>llvm/trunk/lib/Support/APFloat.cpp<br>   <span class="Apple-converted-space"> </span>llvm/trunk/unittests/ADT/APFloatTest.cpp<br><br>Modified: llvm/trunk/lib/Support/APFloat.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=185397&r1=185396&r2=185397&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=185397&r1=185396&r2=185397&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/Support/APFloat.cpp (original)<br>+++ llvm/trunk/lib/Support/APFloat.cpp Mon Jul  1 18:54:08 2013<br>@@ -2481,7 +2481,14 @@ APFloat::convertFromDecimalString(String<br>           <span class="Apple-converted-space"> </span>42039/12655 < L < 28738/8651  [ numerator <= 65536 ]<br>   */<br><br>-  if (decDigitValue(*D.firstSigDigit) >= 10U) {<br>+  // Test if we have a zero number allowing for strings with no null terminators<br>+  // and zero decimals with non-zero exponents.<br>+  //<br>+  // We computed firstSigDigit by ignoring all zeros and dots. Thus if<br>+  // D->firstSigDigit equals str.end(), every digit must be a zero and there can<br>+  // be at most one dot. On the other hand, if we have a zero with a non-zero<br>+  // exponent, then we know that D.firstSigDigit will be non-numeric.<br>+  if (decDigitValue(*D.firstSigDigit) >= 10U || D.firstSigDigit == str.end()) {<br>     category = fcZero;<br>     fs = opOK;<br><br></blockquote><div><br></div><div>Aren't these checks in the wrong order?  It would be nice to avoid dereferencing str.end().</div><div><br></div><div>-Eli</div></div></div></div></div></blockquote></div><br></body></html>