mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-13 15:37:24 +00:00
Tell MSan that memory initialized by libz is valid
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180094 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2848ff01e2
commit
39dd5aafb0
@ -15,6 +15,7 @@
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H
|
||||
@ -55,9 +56,12 @@ zlib::Status zlib::compress(StringRef InputBuffer,
|
||||
Status Res = encodeZlibReturnValue(::compress2(
|
||||
(Bytef *)TmpBuffer.get(), &CompressedSize,
|
||||
(const Bytef *)InputBuffer.data(), InputBuffer.size(), CLevel));
|
||||
if (Res == StatusOK)
|
||||
if (Res == StatusOK) {
|
||||
CompressedBuffer.reset(MemoryBuffer::getMemBufferCopy(
|
||||
StringRef(TmpBuffer.get(), CompressedSize)));
|
||||
// Tell MSan that memory initialized by zlib is valid.
|
||||
__msan_unpoison(CompressedBuffer.data(), CompressedBuffer.size());
|
||||
}
|
||||
return Res;
|
||||
}
|
||||
|
||||
@ -68,9 +72,12 @@ zlib::Status zlib::uncompress(StringRef InputBuffer,
|
||||
Status Res = encodeZlibReturnValue(
|
||||
::uncompress((Bytef *)TmpBuffer.get(), (uLongf *)&UncompressedSize,
|
||||
(const Bytef *)InputBuffer.data(), InputBuffer.size()));
|
||||
if (Res == StatusOK)
|
||||
if (Res == StatusOK) {
|
||||
UncompressedBuffer.reset(MemoryBuffer::getMemBufferCopy(
|
||||
StringRef(TmpBuffer.get(), UncompressedSize)));
|
||||
// Tell MSan that memory initialized by zlib is valid.
|
||||
__msan_unpoison(UncompressedBuffer.data(), UncompressedBuffer.size());
|
||||
}
|
||||
return Res;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user