<div dir="ltr">ping!<div><br></div><div>  Filipe<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 12, 2015 at 5:24 PM, Filipe Cabecinhas <span dir="ltr"><<a href="mailto:filcab+llvm.phabricator@gmail.com" target="_blank">filcab+llvm.phabricator@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi rafael, craig.topper,<br>
<br>
Also tagged a FIXME comment, and added information about why it breaks.<br>
<br>
Bug found using AFL fuzz.<br>
<br>
<a href="http://reviews.llvm.org/D9729" target="_blank">http://reviews.llvm.org/D9729</a><br>
<br>
Files:<br>
  include/llvm/Support/StreamingMemoryObject.h<br>
  test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc<br>
  test/Bitcode/invalid.test<br>
<br>
Index: include/llvm/Support/StreamingMemoryObject.h<br>
===================================================================<br>
--- include/llvm/Support/StreamingMemoryObject.h<br>
+++ include/llvm/Support/StreamingMemoryObject.h<br>
@@ -29,11 +29,12 @@<br>
   uint64_t readBytes(uint8_t *Buf, uint64_t Size,<br>
                      uint64_t Address) const override;<br>
   const uint8_t *getPointer(uint64_t address, uint64_t size) const override {<br>
-    // This could be fixed by ensuring the bytes are fetched and making a copy,<br>
-    // requiring that the bitcode size be known, or otherwise ensuring that<br>
-    // the memory doesn't go away/get reallocated, but it's<br>
-    // not currently necessary. Users that need the pointer don't stream.<br>
-    llvm_unreachable("getPointer in streaming memory objects not allowed");<br>
+    // FIXME: This could be fixed by ensuring the bytes are fetched and<br>
+    // making a copy, requiring that the bitcode size be known, or<br>
+    // otherwise ensuring that the memory doesn't go away/get reallocated,<br>
+    // but it's not currently necessary. Users that need the pointer (any<br>
+    // that need Blobs) don't stream.<br>
+    report_fatal_error("getPointer in streaming memory objects not allowed");<br>
     return nullptr;<br>
   }<br>
   bool isValidAddress(uint64_t address) const override;<br>
Index: test/Bitcode/invalid.test<br>
===================================================================<br>
--- test/Bitcode/invalid.test<br>
+++ test/Bitcode/invalid.test<br>
@@ -127,3 +127,8 @@<br>
 RUN:   FileCheck --check-prefix=GCTABLE-OFLOW %s<br>
<br>
 GCTABLE-OFLOW: Invalid ID<br>
+<br>
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-fixme-streaming-blob.bc 2>&1 | \<br>
+RUN:   FileCheck --check-prefix=STREAMING-BLOB %s<br>
+<br>
+STREAMING-BLOB: getPointer in streaming memory objects not allowed<br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</blockquote></div><br></div></div></div>