diff options
author | Kostya Serebryany <kcc@google.com> | 2016-01-07 01:49:35 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-01-07 01:49:35 +0000 |
commit | 152ac7ad707215f90642a98c0a70fa6740f22407 (patch) | |
tree | d9bef9834dcee6f97ae74d7c0bed9b899331aee3 /llvm/lib/Fuzzer/FuzzerInterface.h | |
parent | 9ed52e9a9e172631fdfc3d58a62012412bec7a51 (diff) | |
download | bcm5719-llvm-152ac7ad707215f90642a98c0a70fa6740f22407.tar.gz bcm5719-llvm-152ac7ad707215f90642a98c0a70fa6740f22407.zip |
[libFuzzer] add a position hint to the dictionary-based mutator
llvm-svn: 257013
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerInterface.h')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerInterface.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInterface.h b/llvm/lib/Fuzzer/FuzzerInterface.h index 65f1707ba92..0950a1a6610 100644 --- a/llvm/lib/Fuzzer/FuzzerInterface.h +++ b/llvm/lib/Fuzzer/FuzzerInterface.h @@ -16,6 +16,7 @@ #ifndef LLVM_FUZZER_INTERFACE_H #define LLVM_FUZZER_INTERFACE_H +#include <limits> #include <cstddef> #include <cstdint> #include <vector> @@ -86,9 +87,13 @@ class MutationDispatcher { /// Mutates data by chanding one bit. size_t Mutate_ChangeBit(uint8_t *Data, size_t Size, size_t MaxSize); - /// Mutates data by adding a word from the dictionary. - size_t Mutate_AddWordFromDictionary(uint8_t *Data, size_t Size, - size_t MaxSize); + /// Mutates data by adding a word from the manual dictionary. + size_t Mutate_AddWordFromManualDictionary(uint8_t *Data, size_t Size, + size_t MaxSize); + + /// Mutates data by adding a word from the automatic dictionary. + size_t Mutate_AddWordFromAutoDictionary(uint8_t *Data, size_t Size, + size_t MaxSize); /// Tries to find an ASCII integer in Data, changes it to another ASCII int. size_t Mutate_ChangeASCIIInteger(uint8_t *Data, size_t Size, size_t MaxSize); @@ -104,7 +109,8 @@ class MutationDispatcher { size_t CrossOver(const uint8_t *Data1, size_t Size1, const uint8_t *Data2, size_t Size2, uint8_t *Out, size_t MaxOutSize); - void AddWordToDictionary(const uint8_t *Word, size_t Size); + void AddWordToManualDictionary(const Unit &Word); + void AddWordToAutoDictionary(const Unit &Word, size_t PositionHint); void SetCorpus(const std::vector<Unit> *Corpus); private: |