mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[libFuzzer] remove stale code; NFC
llvm-svn: 307980
This commit is contained in:
parent
76dab62233
commit
05deb6f798
@ -43,8 +43,6 @@ MutationDispatcher::MutationDispatcher(Random &Rand,
|
||||
{&MutationDispatcher::Mutate_CrossOver, "CrossOver"},
|
||||
{&MutationDispatcher::Mutate_AddWordFromManualDictionary,
|
||||
"ManualDict"},
|
||||
{&MutationDispatcher::Mutate_AddWordFromTemporaryAutoDictionary,
|
||||
"TempAutoDict"},
|
||||
{&MutationDispatcher::Mutate_AddWordFromPersistentAutoDictionary,
|
||||
"PersAutoDict"},
|
||||
});
|
||||
@ -165,11 +163,6 @@ size_t MutationDispatcher::Mutate_AddWordFromManualDictionary(uint8_t *Data,
|
||||
return AddWordFromDictionary(ManualDictionary, Data, Size, MaxSize);
|
||||
}
|
||||
|
||||
size_t MutationDispatcher::Mutate_AddWordFromTemporaryAutoDictionary(
|
||||
uint8_t *Data, size_t Size, size_t MaxSize) {
|
||||
return AddWordFromDictionary(TempAutoDictionary, Data, Size, MaxSize);
|
||||
}
|
||||
|
||||
size_t MutationDispatcher::ApplyDictionaryEntry(uint8_t *Data, size_t Size,
|
||||
size_t MaxSize,
|
||||
DictionaryEntry &DE) {
|
||||
@ -537,14 +530,4 @@ void MutationDispatcher::AddWordToManualDictionary(const Word &W) {
|
||||
{W, std::numeric_limits<size_t>::max()});
|
||||
}
|
||||
|
||||
void MutationDispatcher::AddWordToAutoDictionary(DictionaryEntry DE) {
|
||||
static const size_t kMaxAutoDictSize = 1 << 14;
|
||||
if (TempAutoDictionary.size() >= kMaxAutoDictSize) return;
|
||||
TempAutoDictionary.push_back(DE);
|
||||
}
|
||||
|
||||
void MutationDispatcher::ClearAutoDictionary() {
|
||||
TempAutoDictionary.clear();
|
||||
}
|
||||
|
||||
} // namespace fuzzer
|
||||
|
@ -52,10 +52,6 @@ public:
|
||||
size_t Mutate_AddWordFromManualDictionary(uint8_t *Data, size_t Size,
|
||||
size_t MaxSize);
|
||||
|
||||
/// Mutates data by adding a word from the temporary automatic dictionary.
|
||||
size_t Mutate_AddWordFromTemporaryAutoDictionary(uint8_t *Data, size_t Size,
|
||||
size_t MaxSize);
|
||||
|
||||
/// Mutates data by adding a word from the TORC.
|
||||
size_t Mutate_AddWordFromTORC(uint8_t *Data, size_t Size, size_t MaxSize);
|
||||
|
||||
@ -84,8 +80,6 @@ public:
|
||||
|
||||
void AddWordToManualDictionary(const Word &W);
|
||||
|
||||
void AddWordToAutoDictionary(DictionaryEntry DE);
|
||||
void ClearAutoDictionary();
|
||||
void PrintRecommendedDictionary();
|
||||
|
||||
void SetCorpus(const InputCorpus *Corpus) { this->Corpus = Corpus; }
|
||||
|
@ -424,35 +424,6 @@ TEST(FuzzerMutate, AddWordFromDictionary2) {
|
||||
TestAddWordFromDictionary(&MutationDispatcher::Mutate, 1 << 15);
|
||||
}
|
||||
|
||||
void TestAddWordFromDictionaryWithHint(Mutator M, int NumIter) {
|
||||
std::unique_ptr<ExternalFunctions> t(new ExternalFunctions());
|
||||
fuzzer::EF = t.get();
|
||||
Random Rand(0);
|
||||
MutationDispatcher MD(Rand, {});
|
||||
uint8_t W[] = {0xAA, 0xBB, 0xCC, 0xDD, 0xFF, 0xEE, 0xEF};
|
||||
size_t PosHint = 7777;
|
||||
MD.AddWordToAutoDictionary({Word(W, sizeof(W)), PosHint});
|
||||
int FoundMask = 0;
|
||||
for (int i = 0; i < NumIter; i++) {
|
||||
uint8_t T[10000];
|
||||
memset(T, 0, sizeof(T));
|
||||
size_t NewSize = (MD.*M)(T, 9000, 10000);
|
||||
if (NewSize >= PosHint + sizeof(W) &&
|
||||
!memcmp(W, T + PosHint, sizeof(W)))
|
||||
FoundMask = 1;
|
||||
}
|
||||
EXPECT_EQ(FoundMask, 1);
|
||||
}
|
||||
|
||||
TEST(FuzzerMutate, AddWordFromDictionaryWithHint1) {
|
||||
TestAddWordFromDictionaryWithHint(
|
||||
&MutationDispatcher::Mutate_AddWordFromTemporaryAutoDictionary, 1 << 5);
|
||||
}
|
||||
|
||||
TEST(FuzzerMutate, AddWordFromDictionaryWithHint2) {
|
||||
TestAddWordFromDictionaryWithHint(&MutationDispatcher::Mutate, 1 << 10);
|
||||
}
|
||||
|
||||
void TestChangeASCIIInteger(Mutator M, int NumIter) {
|
||||
std::unique_ptr<ExternalFunctions> t(new ExternalFunctions());
|
||||
fuzzer::EF = t.get();
|
||||
|
Loading…
Reference in New Issue
Block a user