diff options
author | Kostya Serebryany <kcc@google.com> | 2016-02-18 21:49:10 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-02-18 21:49:10 +0000 |
commit | a35f7d383faaab6b543022fbeceb6bdf9c274460 (patch) | |
tree | 2cf83d1879bef2cb57efe4325d5e66190b86d860 /llvm/lib/Fuzzer/FuzzerInternal.h | |
parent | 88980d051a3ed8c0f958a6b6473c836c6215b73d (diff) | |
download | bcm5719-llvm-a35f7d383faaab6b543022fbeceb6bdf9c274460.tar.gz bcm5719-llvm-a35f7d383faaab6b543022fbeceb6bdf9c274460.zip |
[libFuzzer] only read MaxLen bytes from every file in the corpus to speedup loading the corpus
llvm-svn: 261267
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerInternal.h')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerInternal.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h index 8a3b936a1d7..1c941abd13b 100644 --- a/llvm/lib/Fuzzer/FuzzerInternal.h +++ b/llvm/lib/Fuzzer/FuzzerInternal.h @@ -65,9 +65,9 @@ typedef FixedWord<27> Word; // 28 bytes. bool IsFile(const std::string &Path); std::string FileToString(const std::string &Path); -Unit FileToVector(const std::string &Path); +Unit FileToVector(const std::string &Path, size_t MaxSize = 0); void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V, - long *Epoch); + long *Epoch, size_t MaxSize); void WriteToFile(const Unit &U, const std::string &Path); void CopyFileToErr(const std::string &Path); // Returns "Dir/FileName" or equivalent for the current OS. @@ -302,9 +302,9 @@ public: void InitializeTraceState(); void AssignTaintLabels(uint8_t *Data, size_t Size); size_t CorpusSize() const { return Corpus.size(); } - void ReadDir(const std::string &Path, long *Epoch) { + void ReadDir(const std::string &Path, long *Epoch, size_t MaxSize) { Printf("Loading corpus: %s\n", Path.c_str()); - ReadDirToVectorOfUnits(Path.c_str(), &Corpus, Epoch); + ReadDirToVectorOfUnits(Path.c_str(), &Corpus, Epoch, MaxSize); } void RereadOutputCorpus(); // Save the current corpus to OutputCorpus. |