1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

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

llvm-svn: 237709
This commit is contained in:
Filipe Cabecinhas 2015-05-19 18:18:10 +00:00
parent cb5500c145
commit 9fd1becc70
3 changed files with 11 additions and 5 deletions

View File

@ -29,11 +29,12 @@ public:
uint64_t readBytes(uint8_t *Buf, uint64_t Size, uint64_t readBytes(uint8_t *Buf, uint64_t Size,
uint64_t Address) const override; uint64_t Address) const override;
const uint8_t *getPointer(uint64_t address, uint64_t size) 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, // FIXME: This could be fixed by ensuring the bytes are fetched and
// requiring that the bitcode size be known, or otherwise ensuring that // making a copy, requiring that the bitcode size be known, or
// the memory doesn't go away/get reallocated, but it's // otherwise ensuring that the memory doesn't go away/get reallocated,
// not currently necessary. Users that need the pointer don't stream. // but it's not currently necessary. Users that need the pointer (any
llvm_unreachable("getPointer in streaming memory objects not allowed"); // that need Blobs) don't stream.
report_fatal_error("getPointer in streaming memory objects not allowed");
return nullptr; return nullptr;
} }
bool isValidAddress(uint64_t address) const override; bool isValidAddress(uint64_t address) const override;

Binary file not shown.

View File

@ -157,3 +157,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-argument-type.bc 2>
RUN: FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s RUN: FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s
INVALID-ARGUMENT-TYPE: Invalid function argument type 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