[PATCH] Change a reachable unreachable to a fatal error.

Filipe Cabecinhas filcab+llvm.phabricator at gmail.com
Mon May 18 14:53:34 PDT 2015


ping!

  Filipe

On Tue, May 12, 2015 at 5:24 PM, Filipe Cabecinhas <
filcab+llvm.phabricator at gmail.com> wrote:

> Hi rafael, craig.topper,
>
> Also tagged a FIXME comment, and added information about why it breaks.
>
> Bug found using AFL fuzz.
>
> http://reviews.llvm.org/D9729
>
> Files:
>   include/llvm/Support/StreamingMemoryObject.h
>   test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc
>   test/Bitcode/invalid.test
>
> Index: include/llvm/Support/StreamingMemoryObject.h
> ===================================================================
> --- include/llvm/Support/StreamingMemoryObject.h
> +++ include/llvm/Support/StreamingMemoryObject.h
> @@ -29,11 +29,12 @@
>    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;
> Index: test/Bitcode/invalid.test
> ===================================================================
> --- test/Bitcode/invalid.test
> +++ test/Bitcode/invalid.test
> @@ -127,3 +127,8 @@
>  RUN:   FileCheck --check-prefix=GCTABLE-OFLOW %s
>
>  GCTABLE-OFLOW: Invalid ID
> +
> +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
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150518/11ebf364/attachment.html>


More information about the llvm-commits mailing list