<div dir="ltr">Ah, yeah, if it's random that's tricky - though are these characters already so rare that the test would have to run for very long to have a reasonably high certainty it should hit them?<br><br>(a warning would also be good - but I'd still be in favor of a test as well if it's practical)</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Feb 5, 2018 at 12:41 PM Matt Morehouse <<a href="mailto:mascasa@google.com">mascasa@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Easiest thing (as Kostya suggested) would be if there was a compiler warning we could enable to catch this case, but I couldn't find one.<div><br></div><div>Maybe we could write a fuzz target that requires the input to contain a specific sequence of special symbols, and then set a timeout that would (hopefully) be hit before this fix and not after.  Could result in some flakiness though since it is possible to generate special symbols without using RandCh.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 5, 2018 at 11:44 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Is there any easy to construct test case that was missing here? (that enabled this bug to go undiscovered until now)</div><div class="m_2153350611367248483HOEnZb"><div class="m_2153350611367248483h5"><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 30, 2018 at 10:27 AM Matt Morehouse via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: morehouse<br>
Date: Tue Jan 30 10:25:55 2018<br>
New Revision: 323802<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=323802&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=323802&view=rev</a><br>
Log:<br>
[libFuzzer] Fix sizeof(ptr) bug.<br>
<br>
sizeof(const char *) returns 4 or 8 when what we really want is the size<br>
of the array.<br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp<br>
<br>
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp?rev=323802&r1=323801&r2=323802&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp?rev=323802&r1=323801&r2=323802&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp (original)<br>
+++ compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp Tue Jan 30 10:25:55 2018<br>
@@ -62,7 +62,7 @@ MutationDispatcher::MutationDispatcher(R<br>
<br>
 static char RandCh(Random &Rand) {<br>
   if (Rand.RandBool()) return Rand(256);<br>
-  const char *Special = "!*'();:@&=+$,/?%#[]012Az-`~.\xff\x00";<br>
+  const char Special[] = "!*'();:@&=+$,/?%#[]012Az-`~.\xff\x00";<br>
   return Special[Rand(sizeof(Special) - 1)];<br>
 }<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>
</div></div></blockquote></div><br></div>
</blockquote></div>