<div dir="auto">Could maybe add an assert along with the patch as well as an assert only test?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 4, 2020, 1:42 PM Sterling Augustine via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">saugustine added a comment.<br>
<br>
The darwin-dsymutil.c tests this code path right now on line 33. I found this error by running it under asan; otherwise it was fully latent.<br>
<br>
It seems pretty clear to me that when End == -1 (StringRef::npos), creating a string ref from that is obviously a bug.<br>
<br>
I'm not even sure how to check for a failure. clang will almost never crash; there is just a very subtle bounds violation or empty stringref. How it manifests itself depends on subsequent usage of the stringref, and stack layout.<br>
<br>
<br>
Repository:<br>
  rG LLVM Github Monorepo<br>
<br>
CHANGES SINCE LAST ACTION<br>
  <a href="https://reviews.llvm.org/D85231/new/" rel="noreferrer noreferrer" target="_blank">https://reviews.llvm.org/D85231/new/</a><br>
<br>
<a href="https://reviews.llvm.org/D85231" rel="noreferrer noreferrer" target="_blank">https://reviews.llvm.org/D85231</a><br>
<br>
</blockquote></div>