diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 08:06:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 08:06:26 +0000 |
commit | 1660d4b7a65d9ad2ce0deaa19d35579ca4084ac5 (patch) | |
tree | 6cf8220b628ebd2ccfc1375dd6516c6996e9abcc /tests/fuzz/unpoison-mutated-buffers-from-libfuzzer.patch | |
parent | Initial commit. (diff) | |
download | cryptsetup-1660d4b7a65d9ad2ce0deaa19d35579ca4084ac5.tar.xz cryptsetup-1660d4b7a65d9ad2ce0deaa19d35579ca4084ac5.zip |
Adding upstream version 2:2.6.1.upstream/2%2.6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fuzz/unpoison-mutated-buffers-from-libfuzzer.patch')
-rw-r--r-- | tests/fuzz/unpoison-mutated-buffers-from-libfuzzer.patch | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/fuzz/unpoison-mutated-buffers-from-libfuzzer.patch b/tests/fuzz/unpoison-mutated-buffers-from-libfuzzer.patch new file mode 100644 index 0000000..1f48339 --- /dev/null +++ b/tests/fuzz/unpoison-mutated-buffers-from-libfuzzer.patch @@ -0,0 +1,29 @@ +diff --git a/src/libfuzzer/libfuzzer_mutator.cc b/src/libfuzzer/libfuzzer_mutator.cc +index 34d144c..b671fd4 100644 +--- a/src/libfuzzer/libfuzzer_mutator.cc ++++ b/src/libfuzzer/libfuzzer_mutator.cc +@@ -14,6 +14,8 @@ + + #include "src/libfuzzer/libfuzzer_mutator.h" + ++#include <sanitizer/msan_interface.h> ++ + #include <string.h> + + #include <algorithm> +@@ -64,6 +66,7 @@ template <class T> + T MutateValue(T v) { + size_t size = + LLVMFuzzerMutate(reinterpret_cast<uint8_t*>(&v), sizeof(v), sizeof(v)); ++ __msan_unpoison(reinterpret_cast<uint8_t*>(&v), size); + memset(reinterpret_cast<uint8_t*>(&v) + size, 0, sizeof(v) - size); + return v; + } +@@ -93,6 +96,7 @@ std::string Mutator::MutateString(const std::string& value, + result.resize(std::max(1, new_size)); + result.resize(LLVMFuzzerMutate(reinterpret_cast<uint8_t*>(&result[0]), + value.size(), result.size())); ++ __msan_unpoison(reinterpret_cast<uint8_t*>(&result[0]), result.size()); + return result; + } + |