On Wed, Dec 19, 2012 at 1:55 PM, Michael Muller <span dir="ltr"><<a href="mailto:mmuller@enduden.com" target="_blank">mmuller@enduden.com</a>></span> wrote:<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


See <a href="http://llvm.org/bugs/show_bug.cgi?id=13678" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=13678</a> for more history.<br>
<br>
See also:<br>
  <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-August/052766.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-August/052766.html</a><br>
  <a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120910/150422.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120910/150422.html</a><br>
  <a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120917/150801.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120917/150801.html</a><br>
  <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056829.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056829.html</a><br>
<br>
When you run out of space writing to a buffer, the buffer management code<br>
simply stops writing at the end of the buffer.  It is the responsibility of<br>
the caller to verify that it has stayed in bounds and perform a retry with<br>
a larger memory estimate if not.  The function writing code does this, but<br>
the exception table code following it does not.  The end result is that<br>
exception table pointers can get registered pointing to invalid data, causing<br>
seg-faults when an exception is thrown.<br></blockquote><div><br></div><div>Minor drive-by style comments (I wish there were a web UI for entering these in context):</div><div><ul><li>s/;;/;/</li><li>ASSERT_TRUE(actual == expected) --> ASSERT_EQ(expected, actual)</li>

<li>add space around binary operators (-, *, etc.), e.g.:</li></ul></div><div><pre style="word-wrap:break-word;white-space:pre-wrap">+      ActualSize = (CurBufferPtr-BufferBegin)*2;
</pre></div><div><ul><li>fix arg alignment of "ActualSize" here:</li></ul></div><div><pre style="word-wrap:break-word;white-space:pre-wrap">+    while (true) {
+      BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
+                                                              ActualSize);</pre><div>Misha</div></div></div>