[PATCH] D71031: [compiler-rt] FuzzedDataProvider: do not call memcpy on empty vector.
Max Moroz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 14:21:32 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa44ef027ebca: [compiler-rt] FuzzedDataProvider: do not call memcpy on empty vector. (authored by Dor1s).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71031/new/
https://reviews.llvm.org/D71031
Files:
compiler-rt/include/fuzzer/FuzzedDataProvider.h
Index: compiler-rt/include/fuzzer/FuzzedDataProvider.h
===================================================================
--- compiler-rt/include/fuzzer/FuzzedDataProvider.h
+++ compiler-rt/include/fuzzer/FuzzedDataProvider.h
@@ -263,6 +263,12 @@
// which seems to be a natural choice for other implementations as well.
// To increase the odds even more, we also call |shrink_to_fit| below.
std::vector<T> result(size);
+ if (size == 0) {
+ if (num_bytes_to_consume != 0)
+ abort();
+ return result;
+ }
+
std::memcpy(result.data(), data_ptr_, num_bytes_to_consume);
Advance(num_bytes_to_consume);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71031.232212.patch
Type: text/x-patch
Size: 649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191204/210cb680/attachment.bin>
More information about the llvm-commits
mailing list