<br><br>On Thursday, June 2, 2016, Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">zturner added inline comments.<br>
<br>
================<br>
Comment at: include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h:43<br>
@@ +42,3 @@<br>
+        (sizeof(LineNumberEntry) + (HasColumn ? sizeof(ColumnNumberEntry) : 0));<br>
+    uint32_t Size = BlockHeader->BlockSize - sizeof(LineFileBlockHeader);<br>
+    if (LineInfoSize > Size)<br>
----------------<br>
majnemer wrote:<br>
> What if BlockSize is smaller than LineFileBlockHeader?<br>
That would indicate a corrupt record.  So yea, I should check for that.<br>
<br>
================<br>
Comment at: include/llvm/DebugInfo/CodeView/StreamArray.h:213<br>
@@ +212,3 @@<br>
+      : Array(Array), Index(ArrayIndex) {<br>
+    if (Array.size() <= Index)<br>
+      Index = uint32_t(-1);<br>
----------------<br>
majnemer wrote:<br>
> Should it be an error for Array.size() to be -1?<br>
If it were easy to make it work, then we should, but to do that we'd probably need to increase the size of the iterator, and I'm not sure it's worth it.   I think the only way that can ever happen is if your StreamRef is 2^32-1 bytes long, and I don't know that it's even possible to have a stream that big (I recall there are constants somewhere in the cv header files that determine how big a stream can be based on the block size and whether large blocks are enabled).  I can look into it a bit more when I get home, but this would be a pretty exceptional circumstance.<br>
<br></blockquote><div><br></div><div>It should be impossible because a stream size of -1 means "no stream"</div><div><br></div><div>I think an assert would be sufficient</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<a href="http://reviews.llvm.org/D20936" target="_blank">http://reviews.llvm.org/D20936</a><br>
<br>
<br>
<br>
</blockquote>