[llvm] r265866 - [libfuzzer] defensive assert
Mike Aizatsky via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 8 16:32:25 PDT 2016
Author: aizatsky
Date: Fri Apr 8 18:32:24 2016
New Revision: 265866
URL: http://llvm.org/viewvc/llvm-project?rev=265866&view=rev
Log:
[libfuzzer] defensive assert
Modified:
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=265866&r1=265865&r2=265866&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Fri Apr 8 18:32:24 2016
@@ -503,8 +503,9 @@ void Fuzzer::MutateAndTestOne() {
auto &U = ChooseUnitToMutate();
MutateInPlaceHere.resize(Options.MaxLen);
- memcpy(MutateInPlaceHere.data(), U.data(), U.size());
size_t Size = U.size();
+ assert(Size <= Options.MaxLen && "Oversized Unit");
+ memcpy(MutateInPlaceHere.data(), U.data(), Size);
for (int i = 0; i < Options.MutateDepth; i++) {
size_t NewSize = 0;
More information about the llvm-commits
mailing list