[llvm] r237709 - Change a reachable unreachable to a fatal error.

Filipe Cabecinhas me at filcab.net
Tue May 19 11:18:11 PDT 2015


Author: filcab
Date: Tue May 19 13:18:10 2015
New Revision: 237709

URL: http://llvm.org/viewvc/llvm-project?rev=237709&view=rev
Log:
Change a reachable unreachable to a fatal error.

Summary:
Also tagged a FIXME comment, and added information about why it breaks.

Bug found using AFL fuzz.

Reviewers: rafael, craig.topper

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D9729

Added:
    llvm/trunk/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc
Modified:
    llvm/trunk/include/llvm/Support/StreamingMemoryObject.h
    llvm/trunk/test/Bitcode/invalid.test

Modified: llvm/trunk/include/llvm/Support/StreamingMemoryObject.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StreamingMemoryObject.h?rev=237709&r1=237708&r2=237709&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/StreamingMemoryObject.h (original)
+++ llvm/trunk/include/llvm/Support/StreamingMemoryObject.h Tue May 19 13:18:10 2015
@@ -29,11 +29,12 @@ public:
   uint64_t readBytes(uint8_t *Buf, uint64_t Size,
                      uint64_t Address) const override;
   const uint8_t *getPointer(uint64_t address, uint64_t size) const override {
-    // This could be fixed by ensuring the bytes are fetched and making a copy,
-    // requiring that the bitcode size be known, or otherwise ensuring that
-    // the memory doesn't go away/get reallocated, but it's
-    // not currently necessary. Users that need the pointer don't stream.
-    llvm_unreachable("getPointer in streaming memory objects not allowed");
+    // FIXME: This could be fixed by ensuring the bytes are fetched and
+    // making a copy, requiring that the bitcode size be known, or
+    // otherwise ensuring that the memory doesn't go away/get reallocated,
+    // but it's not currently necessary. Users that need the pointer (any
+    // that need Blobs) don't stream.
+    report_fatal_error("getPointer in streaming memory objects not allowed");
     return nullptr;
   }
   bool isValidAddress(uint64_t address) const override;

Added: llvm/trunk/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc?rev=237709&view=auto
==============================================================================
Binary files llvm/trunk/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc (added) and llvm/trunk/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc Tue May 19 13:18:10 2015 differ

Modified: llvm/trunk/test/Bitcode/invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.test?rev=237709&r1=237708&r2=237709&view=diff
==============================================================================
--- llvm/trunk/test/Bitcode/invalid.test (original)
+++ llvm/trunk/test/Bitcode/invalid.test Tue May 19 13:18:10 2015
@@ -157,3 +157,8 @@ RUN: not llvm-dis -disable-output %p/Inp
 RUN:   FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s
 
 INVALID-ARGUMENT-TYPE: Invalid function argument type
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-fixme-streaming-blob.bc 2>&1 | \
+RUN:   FileCheck --check-prefix=STREAMING-BLOB %s
+
+STREAMING-BLOB: getPointer in streaming memory objects not allowed





More information about the llvm-commits mailing list