[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 13:32:26 PST 2019
Dor1s updated this revision to Diff 232196.
Dor1s added a comment.
- remove empty line
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,9 @@
// 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)
+ 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.232196.patch
Type: text/x-patch
Size: 583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191204/7f1e71c4/attachment.bin>
More information about the llvm-commits
mailing list