aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerMutate.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-01-09 03:08:58 +0000
committerKostya Serebryany <kcc@google.com>2016-01-09 03:08:58 +0000
commitb65805a9395f2427b78f94f1f26fe42fd73511ed (patch)
tree08542ae3f82791148815cb660c0ac02fe379d77f /llvm/lib/Fuzzer/FuzzerMutate.cpp
parent0593cfd336dcc153b8bf834d84fc903dceffa228 (diff)
downloadllvm-b65805a9395f2427b78f94f1f26fe42fd73511ed.zip
llvm-b65805a9395f2427b78f94f1f26fe42fd73511ed.tar.gz
llvm-b65805a9395f2427b78f94f1f26fe42fd73511ed.tar.bz2
[libFuzzer] change the way trace-based mutations are applied. Instead of a custom code just rely on the automatically created dictionary
llvm-svn: 257248
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerMutate.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerMutate.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerMutate.cpp b/llvm/lib/Fuzzer/FuzzerMutate.cpp
index 11d320b..219837f 100644
--- a/llvm/lib/Fuzzer/FuzzerMutate.cpp
+++ b/llvm/lib/Fuzzer/FuzzerMutate.cpp
@@ -250,9 +250,15 @@ void MutationDispatcher::AddWordToManualDictionary(const Unit &Word) {
void MutationDispatcher::AddWordToAutoDictionary(const Unit &Word,
size_t PositionHint) {
+ static const size_t kMaxAutoDictSize = 1 << 14;
+ if (MDImpl->AutoDictionary.size() >= kMaxAutoDictSize) return;
MDImpl->AutoDictionary.push_back({Word, PositionHint});
}
+void MutationDispatcher::ClearAutoDictionary() {
+ MDImpl->AutoDictionary.clear();
+}
+
MutationDispatcher::MutationDispatcher(FuzzerRandomBase &Rand) : Rand(Rand) {
MDImpl = new Impl(Rand);
}