gallivm/cache: don't require a null terminator for cache data.
authorDave Airlie <airlied@redhat.com>
Mon, 15 Jun 2020 00:16:06 +0000 (10:16 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 15 Jun 2020 23:48:01 +0000 (09:48 +1000)
Fixes crashes seen with
./bin/egl_ext_device_base
since cache support was added.

Fixes: 4962d3e10733 ("gallivm: add cache interface to mcjit")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3118
Tested-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5467>

src/gallium/auxiliary/gallivm/lp_bld_misc.cpp

index 6f63ab50ded4e5a773d36add19ec605772d81aeb..9b75676a4e295324bb71c32fc5d1c899825de36b 100644 (file)
@@ -313,7 +313,7 @@ public:
 
    virtual std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module *M) {
       if (cache_out->data_size) {
-         return llvm::MemoryBuffer::getMemBuffer(llvm::StringRef((const char *)cache_out->data, cache_out->data_size));
+         return llvm::MemoryBuffer::getMemBuffer(llvm::StringRef((const char *)cache_out->data, cache_out->data_size), "", false);
       }
       return NULL;
    }