forked from OSchip/llvm-project
[libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected.
[libFuzzer] replace Vector/Set with std::vector/std::set. Reviewed By: morehouse Differential Revision: https://reviews.llvm.org/D107374
This commit is contained in:
parent
3943a74666
commit
7c921753e0
|
@ -41,7 +41,8 @@ inline uint32_t Clzll(uint64_t X) {
|
|||
#if !defined(_M_ARM) && !defined(_M_X64)
|
||||
// Scan the high 32 bits.
|
||||
if (_BitScanReverse(&LeadZeroIdx, static_cast<unsigned long>(X >> 32)))
|
||||
return static_cast<int>(63 - (LeadZeroIdx + 32)); // Create a bit offset from the MSB.
|
||||
return static_cast<int>(
|
||||
63 - (LeadZeroIdx + 32)); // Create a bit offset from the MSB.
|
||||
// Scan the low 32 bits.
|
||||
if (_BitScanReverse(&LeadZeroIdx, static_cast<unsigned long>(X)))
|
||||
return static_cast<int>(63 - LeadZeroIdx);
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
Command() : CombinedOutAndErr(false) {}
|
||||
|
||||
explicit Command(const Vector<std::string> &ArgsToAdd)
|
||||
explicit Command(const std::vector<std::string> &ArgsToAdd)
|
||||
: Args(ArgsToAdd), CombinedOutAndErr(false) {}
|
||||
|
||||
explicit Command(const Command &Other)
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
// Gets all of the current command line arguments, **including** those after
|
||||
// "-ignore-remaining-args=1".
|
||||
const Vector<std::string> &getArguments() const { return Args; }
|
||||
const std::vector<std::string> &getArguments() const { return Args; }
|
||||
|
||||
// Adds the given argument before "-ignore_remaining_args=1", or at the end
|
||||
// if that flag isn't present.
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
// Adds all given arguments before "-ignore_remaining_args=1", or at the end
|
||||
// if that flag isn't present.
|
||||
void addArguments(const Vector<std::string> &ArgsToAdd) {
|
||||
void addArguments(const std::vector<std::string> &ArgsToAdd) {
|
||||
Args.insert(endMutableArgs(), ArgsToAdd.begin(), ArgsToAdd.end());
|
||||
}
|
||||
|
||||
|
@ -155,16 +155,16 @@ private:
|
|||
Command(Command &&Other) = delete;
|
||||
Command &operator=(Command &&Other) = delete;
|
||||
|
||||
Vector<std::string>::iterator endMutableArgs() {
|
||||
std::vector<std::string>::iterator endMutableArgs() {
|
||||
return std::find(Args.begin(), Args.end(), ignoreRemainingArgs());
|
||||
}
|
||||
|
||||
Vector<std::string>::const_iterator endMutableArgs() const {
|
||||
std::vector<std::string>::const_iterator endMutableArgs() const {
|
||||
return std::find(Args.begin(), Args.end(), ignoreRemainingArgs());
|
||||
}
|
||||
|
||||
// The command arguments. Args[0] is the command name.
|
||||
Vector<std::string> Args;
|
||||
std::vector<std::string> Args;
|
||||
|
||||
// True indicates stderr is redirected to stdout.
|
||||
bool CombinedOutAndErr;
|
||||
|
|
|
@ -39,13 +39,13 @@ struct InputInfo {
|
|||
bool MayDeleteFile = false;
|
||||
bool Reduced = false;
|
||||
bool HasFocusFunction = false;
|
||||
Vector<uint32_t> UniqFeatureSet;
|
||||
Vector<uint8_t> DataFlowTraceForFocusFunction;
|
||||
std::vector<uint32_t> UniqFeatureSet;
|
||||
std::vector<uint8_t> DataFlowTraceForFocusFunction;
|
||||
// Power schedule.
|
||||
bool NeedsEnergyUpdate = false;
|
||||
double Energy = 0.0;
|
||||
double SumIncidence = 0.0;
|
||||
Vector<std::pair<uint32_t, uint16_t>> FeatureFreqs;
|
||||
std::vector<std::pair<uint32_t, uint16_t>> FeatureFreqs;
|
||||
|
||||
// Delete feature Idx and its frequency from FeatureFreqs.
|
||||
bool DeleteFeatureFreq(uint32_t Idx) {
|
||||
|
@ -209,7 +209,7 @@ public:
|
|||
InputInfo *AddToCorpus(const Unit &U, size_t NumFeatures, bool MayDeleteFile,
|
||||
bool HasFocusFunction, bool NeverReduce,
|
||||
std::chrono::microseconds TimeOfUnit,
|
||||
const Vector<uint32_t> &FeatureSet,
|
||||
const std::vector<uint32_t> &FeatureSet,
|
||||
const DataFlowTrace &DFT, const InputInfo *BaseII) {
|
||||
assert(!U.empty());
|
||||
if (FeatureDebug)
|
||||
|
@ -258,7 +258,7 @@ public:
|
|||
}
|
||||
|
||||
// Debug-only
|
||||
void PrintFeatureSet(const Vector<uint32_t> &FeatureSet) {
|
||||
void PrintFeatureSet(const std::vector<uint32_t> &FeatureSet) {
|
||||
if (!FeatureDebug) return;
|
||||
Printf("{");
|
||||
for (uint32_t Feature: FeatureSet)
|
||||
|
@ -325,7 +325,8 @@ public:
|
|||
const auto &II = *Inputs[i];
|
||||
Printf(" [% 3zd %s] sz: % 5zd runs: % 5zd succ: % 5zd focus: %d\n", i,
|
||||
Sha1ToString(II.Sha1).c_str(), II.U.size(),
|
||||
II.NumExecutedMutations, II.NumSuccessfullMutations, II.HasFocusFunction);
|
||||
II.NumExecutedMutations, II.NumSuccessfullMutations,
|
||||
II.HasFocusFunction);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,11 +564,11 @@ private:
|
|||
}
|
||||
std::piecewise_constant_distribution<double> CorpusDistribution;
|
||||
|
||||
Vector<double> Intervals;
|
||||
Vector<double> Weights;
|
||||
std::vector<double> Intervals;
|
||||
std::vector<double> Weights;
|
||||
|
||||
std::unordered_set<std::string> Hashes;
|
||||
Vector<InputInfo*> Inputs;
|
||||
std::vector<InputInfo *> Inputs;
|
||||
|
||||
size_t NumAddedFeatures = 0;
|
||||
size_t NumUpdatedFeatures = 0;
|
||||
|
@ -577,7 +578,7 @@ private:
|
|||
bool DistributionNeedsUpdate = true;
|
||||
uint16_t FreqOfMostAbundantRareFeature = 0;
|
||||
uint16_t GlobalFeatureFreqs[kFeatureSetSize] = {};
|
||||
Vector<uint32_t> RareFeatures;
|
||||
std::vector<uint32_t> RareFeatures;
|
||||
|
||||
std::string OutputCorpus;
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ bool BlockCoverage::AppendCoverage(std::istream &IN) {
|
|||
continue;
|
||||
}
|
||||
if (L[0] != 'C') continue;
|
||||
Vector<uint32_t> CoveredBlocks;
|
||||
std::vector<uint32_t> CoveredBlocks;
|
||||
while (true) {
|
||||
uint32_t BB = 0;
|
||||
SS >> BB;
|
||||
|
@ -68,7 +68,7 @@ bool BlockCoverage::AppendCoverage(std::istream &IN) {
|
|||
auto It = Functions.find(FunctionId);
|
||||
auto &Counters =
|
||||
It == Functions.end()
|
||||
? Functions.insert({FunctionId, Vector<uint32_t>(NumBlocks)})
|
||||
? Functions.insert({FunctionId, std::vector<uint32_t>(NumBlocks)})
|
||||
.first->second
|
||||
: It->second;
|
||||
|
||||
|
@ -86,8 +86,8 @@ bool BlockCoverage::AppendCoverage(std::istream &IN) {
|
|||
// * any uncovered function gets weight 0.
|
||||
// * a function with lots of uncovered blocks gets bigger weight.
|
||||
// * a function with a less frequently executed code gets bigger weight.
|
||||
Vector<double> BlockCoverage::FunctionWeights(size_t NumFunctions) const {
|
||||
Vector<double> Res(NumFunctions);
|
||||
std::vector<double> BlockCoverage::FunctionWeights(size_t NumFunctions) const {
|
||||
std::vector<double> Res(NumFunctions);
|
||||
for (auto It : Functions) {
|
||||
auto FunctionID = It.first;
|
||||
auto Counters = It.second;
|
||||
|
@ -104,7 +104,7 @@ Vector<double> BlockCoverage::FunctionWeights(size_t NumFunctions) const {
|
|||
}
|
||||
|
||||
void DataFlowTrace::ReadCoverage(const std::string &DirPath) {
|
||||
Vector<SizedFile> Files;
|
||||
std::vector<SizedFile> Files;
|
||||
GetSizedFilesFromDir(DirPath, &Files);
|
||||
for (auto &SF : Files) {
|
||||
auto Name = Basename(SF.File);
|
||||
|
@ -115,16 +115,16 @@ void DataFlowTrace::ReadCoverage(const std::string &DirPath) {
|
|||
}
|
||||
}
|
||||
|
||||
static void DFTStringAppendToVector(Vector<uint8_t> *DFT,
|
||||
static void DFTStringAppendToVector(std::vector<uint8_t> *DFT,
|
||||
const std::string &DFTString) {
|
||||
assert(DFT->size() == DFTString.size());
|
||||
for (size_t I = 0, Len = DFT->size(); I < Len; I++)
|
||||
(*DFT)[I] = DFTString[I] == '1';
|
||||
}
|
||||
|
||||
// converts a string of '0' and '1' into a Vector<uint8_t>
|
||||
static Vector<uint8_t> DFTStringToVector(const std::string &DFTString) {
|
||||
Vector<uint8_t> DFT(DFTString.size());
|
||||
// converts a string of '0' and '1' into a std::vector<uint8_t>
|
||||
static std::vector<uint8_t> DFTStringToVector(const std::string &DFTString) {
|
||||
std::vector<uint8_t> DFT(DFTString.size());
|
||||
DFTStringAppendToVector(&DFT, DFTString);
|
||||
return DFT;
|
||||
}
|
||||
|
@ -159,14 +159,14 @@ static bool ParseDFTLine(const std::string &Line, size_t *FunctionNum,
|
|||
}
|
||||
|
||||
bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
|
||||
Vector<SizedFile> &CorporaFiles, Random &Rand) {
|
||||
std::vector<SizedFile> &CorporaFiles, Random &Rand) {
|
||||
if (DirPath.empty()) return false;
|
||||
Printf("INFO: DataFlowTrace: reading from '%s'\n", DirPath.c_str());
|
||||
Vector<SizedFile> Files;
|
||||
std::vector<SizedFile> Files;
|
||||
GetSizedFilesFromDir(DirPath, &Files);
|
||||
std::string L;
|
||||
size_t FocusFuncIdx = SIZE_MAX;
|
||||
Vector<std::string> FunctionNames;
|
||||
std::vector<std::string> FunctionNames;
|
||||
|
||||
// Collect the hashes of the corpus files.
|
||||
for (auto &SF : CorporaFiles)
|
||||
|
@ -191,7 +191,7 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
|
|||
// * chooses a random function according to the weights.
|
||||
ReadCoverage(DirPath);
|
||||
auto Weights = Coverage.FunctionWeights(NumFunctions);
|
||||
Vector<double> Intervals(NumFunctions + 1);
|
||||
std::vector<double> Intervals(NumFunctions + 1);
|
||||
std::iota(Intervals.begin(), Intervals.end(), 0);
|
||||
auto Distribution = std::piecewise_constant_distribution<double>(
|
||||
Intervals.begin(), Intervals.end(), Weights.begin());
|
||||
|
@ -247,7 +247,7 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
|
|||
}
|
||||
|
||||
int CollectDataFlow(const std::string &DFTBinary, const std::string &DirPath,
|
||||
const Vector<SizedFile> &CorporaFiles) {
|
||||
const std::vector<SizedFile> &CorporaFiles) {
|
||||
Printf("INFO: collecting data flow: bin: %s dir: %s files: %zd\n",
|
||||
DFTBinary.c_str(), DirPath.c_str(), CorporaFiles.size());
|
||||
if (CorporaFiles.empty()) {
|
||||
|
@ -265,7 +265,7 @@ int CollectDataFlow(const std::string &DFTBinary, const std::string &DirPath,
|
|||
// we then request tags in [0,Size/2) and [Size/2, Size), and so on.
|
||||
// Function number => DFT.
|
||||
auto OutPath = DirPlusFile(DirPath, Hash(FileToVector(F.File)));
|
||||
std::unordered_map<size_t, Vector<uint8_t>> DFTMap;
|
||||
std::unordered_map<size_t, std::vector<uint8_t>> DFTMap;
|
||||
std::unordered_set<std::string> Cov;
|
||||
Command Cmd;
|
||||
Cmd.addArgument(DFTBinary);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
namespace fuzzer {
|
||||
|
||||
int CollectDataFlow(const std::string &DFTBinary, const std::string &DirPath,
|
||||
const Vector<SizedFile> &CorporaFiles);
|
||||
const std::vector<SizedFile> &CorporaFiles);
|
||||
|
||||
class BlockCoverage {
|
||||
public:
|
||||
|
@ -77,11 +77,11 @@ public:
|
|||
return Result;
|
||||
}
|
||||
|
||||
Vector<double> FunctionWeights(size_t NumFunctions) const;
|
||||
std::vector<double> FunctionWeights(size_t NumFunctions) const;
|
||||
void clear() { Functions.clear(); }
|
||||
|
||||
private:
|
||||
typedef Vector<uint32_t> CoverageVector;
|
||||
typedef std::vector<uint32_t> CoverageVector;
|
||||
|
||||
uint32_t NumberOfCoveredBlocks(const CoverageVector &Counters) const {
|
||||
uint32_t Res = 0;
|
||||
|
@ -117,9 +117,9 @@ class DataFlowTrace {
|
|||
public:
|
||||
void ReadCoverage(const std::string &DirPath);
|
||||
bool Init(const std::string &DirPath, std::string *FocusFunction,
|
||||
Vector<SizedFile> &CorporaFiles, Random &Rand);
|
||||
std::vector<SizedFile> &CorporaFiles, Random &Rand);
|
||||
void Clear() { Traces.clear(); }
|
||||
const Vector<uint8_t> *Get(const std::string &InputSha1) const {
|
||||
const std::vector<uint8_t> *Get(const std::string &InputSha1) const {
|
||||
auto It = Traces.find(InputSha1);
|
||||
if (It != Traces.end())
|
||||
return &It->second;
|
||||
|
@ -128,9 +128,9 @@ class DataFlowTrace {
|
|||
|
||||
private:
|
||||
// Input's sha1 => DFT for the FocusFunction.
|
||||
std::unordered_map<std::string, Vector<uint8_t> > Traces;
|
||||
BlockCoverage Coverage;
|
||||
std::unordered_set<std::string> CorporaHashes;
|
||||
std::unordered_map<std::string, std::vector<uint8_t>> Traces;
|
||||
BlockCoverage Coverage;
|
||||
std::unordered_set<std::string> CorporaHashes;
|
||||
};
|
||||
} // namespace fuzzer
|
||||
|
||||
|
|
|
@ -38,28 +38,8 @@ struct ExternalFunctions;
|
|||
// Global interface to functions that may or may not be available.
|
||||
extern ExternalFunctions *EF;
|
||||
|
||||
// We are using a custom allocator to give a different symbol name to STL
|
||||
// containers in order to avoid ODR violations.
|
||||
template<typename T>
|
||||
class fuzzer_allocator: public std::allocator<T> {
|
||||
public:
|
||||
fuzzer_allocator() = default;
|
||||
|
||||
template<class U>
|
||||
fuzzer_allocator(const fuzzer_allocator<U>&) {}
|
||||
|
||||
template<class Other>
|
||||
struct rebind { typedef fuzzer_allocator<Other> other; };
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
using Vector = std::vector<T, fuzzer_allocator<T>>;
|
||||
|
||||
template<typename T>
|
||||
using Set = std::set<T, std::less<T>, fuzzer_allocator<T>>;
|
||||
|
||||
typedef Vector<uint8_t> Unit;
|
||||
typedef Vector<Unit> UnitVector;
|
||||
typedef std::vector<uint8_t> Unit;
|
||||
typedef std::vector<Unit> UnitVector;
|
||||
typedef int (*UserCallback)(const uint8_t *Data, size_t Size);
|
||||
|
||||
int FuzzerDriver(int *argc, char ***argv, UserCallback Callback);
|
||||
|
|
|
@ -52,10 +52,13 @@ class DictionaryEntry {
|
|||
public:
|
||||
DictionaryEntry() {}
|
||||
DictionaryEntry(Word W) : W(W) {}
|
||||
DictionaryEntry(Word W, size_t PositionHint) : W(W), PositionHint(PositionHint) {}
|
||||
DictionaryEntry(Word W, size_t PositionHint)
|
||||
: W(W), PositionHint(PositionHint) {}
|
||||
const Word &GetW() const { return W; }
|
||||
|
||||
bool HasPositionHint() const { return PositionHint != std::numeric_limits<size_t>::max(); }
|
||||
bool HasPositionHint() const {
|
||||
return PositionHint != std::numeric_limits<size_t>::max();
|
||||
}
|
||||
size_t GetPositionHint() const {
|
||||
assert(HasPositionHint());
|
||||
return PositionHint;
|
||||
|
@ -113,7 +116,7 @@ private:
|
|||
bool ParseOneDictionaryEntry(const std::string &Str, Unit *U);
|
||||
// Parses the dictionary file, fills Units, returns true iff all lines
|
||||
// were parsed successfully.
|
||||
bool ParseDictionaryFile(const std::string &Text, Vector<Unit> *Units);
|
||||
bool ParseDictionaryFile(const std::string &Text, std::vector<Unit> *Units);
|
||||
|
||||
} // namespace fuzzer
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ static const FlagDescription FlagDescriptions [] {
|
|||
static const size_t kNumFlags =
|
||||
sizeof(FlagDescriptions) / sizeof(FlagDescriptions[0]);
|
||||
|
||||
static Vector<std::string> *Inputs;
|
||||
static std::vector<std::string> *Inputs;
|
||||
static std::string *ProgName;
|
||||
|
||||
static void PrintHelp() {
|
||||
|
@ -187,7 +187,7 @@ static bool ParseOneFlag(const char *Param) {
|
|||
}
|
||||
|
||||
// We don't use any library to minimize dependencies.
|
||||
static void ParseFlags(const Vector<std::string> &Args,
|
||||
static void ParseFlags(const std::vector<std::string> &Args,
|
||||
const ExternalFunctions *EF) {
|
||||
for (size_t F = 0; F < kNumFlags; F++) {
|
||||
if (FlagDescriptions[F].IntFlag)
|
||||
|
@ -206,7 +206,7 @@ static void ParseFlags(const Vector<std::string> &Args,
|
|||
"Disabling -len_control by default.\n", EF->LLVMFuzzerCustomMutator);
|
||||
}
|
||||
|
||||
Inputs = new Vector<std::string>;
|
||||
Inputs = new std::vector<std::string>;
|
||||
for (size_t A = 1; A < Args.size(); A++) {
|
||||
if (ParseOneFlag(Args[A].c_str())) {
|
||||
if (Flags.ignore_remaining_args)
|
||||
|
@ -272,7 +272,7 @@ static void ValidateDirectoryExists(const std::string &Path,
|
|||
exit(1);
|
||||
}
|
||||
|
||||
std::string CloneArgsWithoutX(const Vector<std::string> &Args,
|
||||
std::string CloneArgsWithoutX(const std::vector<std::string> &Args,
|
||||
const char *X1, const char *X2) {
|
||||
std::string Cmd;
|
||||
for (auto &S : Args) {
|
||||
|
@ -283,18 +283,19 @@ std::string CloneArgsWithoutX(const Vector<std::string> &Args,
|
|||
return Cmd;
|
||||
}
|
||||
|
||||
static int RunInMultipleProcesses(const Vector<std::string> &Args,
|
||||
static int RunInMultipleProcesses(const std::vector<std::string> &Args,
|
||||
unsigned NumWorkers, unsigned NumJobs) {
|
||||
std::atomic<unsigned> Counter(0);
|
||||
std::atomic<bool> HasErrors(false);
|
||||
Command Cmd(Args);
|
||||
Cmd.removeFlag("jobs");
|
||||
Cmd.removeFlag("workers");
|
||||
Vector<std::thread> V;
|
||||
std::vector<std::thread> V;
|
||||
std::thread Pulse(PulseThread);
|
||||
Pulse.detach();
|
||||
for (unsigned i = 0; i < NumWorkers; i++)
|
||||
V.push_back(std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors));
|
||||
V.push_back(std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs,
|
||||
&HasErrors));
|
||||
for (auto &T : V)
|
||||
T.join();
|
||||
return HasErrors ? 1 : 0;
|
||||
|
@ -348,8 +349,8 @@ static std::string GetDedupTokenFromCmdOutput(const std::string &S) {
|
|||
return S.substr(Beg, End - Beg);
|
||||
}
|
||||
|
||||
int CleanseCrashInput(const Vector<std::string> &Args,
|
||||
const FuzzingOptions &Options) {
|
||||
int CleanseCrashInput(const std::vector<std::string> &Args,
|
||||
const FuzzingOptions &Options) {
|
||||
if (Inputs->size() != 1 || !Flags.exact_artifact_path) {
|
||||
Printf("ERROR: -cleanse_crash should be given one input file and"
|
||||
" -exact_artifact_path\n");
|
||||
|
@ -372,7 +373,7 @@ int CleanseCrashInput(const Vector<std::string> &Args,
|
|||
auto U = FileToVector(CurrentFilePath);
|
||||
size_t Size = U.size();
|
||||
|
||||
const Vector<uint8_t> ReplacementBytes = {' ', 0xff};
|
||||
const std::vector<uint8_t> ReplacementBytes = {' ', 0xff};
|
||||
for (int NumAttempts = 0; NumAttempts < 5; NumAttempts++) {
|
||||
bool Changed = false;
|
||||
for (size_t Idx = 0; Idx < Size; Idx++) {
|
||||
|
@ -403,7 +404,7 @@ int CleanseCrashInput(const Vector<std::string> &Args,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int MinimizeCrashInput(const Vector<std::string> &Args,
|
||||
int MinimizeCrashInput(const std::vector<std::string> &Args,
|
||||
const FuzzingOptions &Options) {
|
||||
if (Inputs->size() != 1) {
|
||||
Printf("ERROR: -minimize_crash should be given one input file\n");
|
||||
|
@ -503,14 +504,15 @@ int MinimizeCrashInputInternalStep(Fuzzer *F, InputCorpus *Corpus) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void Merge(Fuzzer *F, FuzzingOptions &Options, const Vector<std::string> &Args,
|
||||
const Vector<std::string> &Corpora, const char *CFPathOrNull) {
|
||||
void Merge(Fuzzer *F, FuzzingOptions &Options,
|
||||
const std::vector<std::string> &Args,
|
||||
const std::vector<std::string> &Corpora, const char *CFPathOrNull) {
|
||||
if (Corpora.size() < 2) {
|
||||
Printf("INFO: Merge requires two or more corpus dirs\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Vector<SizedFile> OldCorpus, NewCorpus;
|
||||
std::vector<SizedFile> OldCorpus, NewCorpus;
|
||||
GetSizedFilesFromDir(Corpora[0], &OldCorpus);
|
||||
for (size_t i = 1; i < Corpora.size(); i++)
|
||||
GetSizedFilesFromDir(Corpora[i], &NewCorpus);
|
||||
|
@ -518,8 +520,8 @@ void Merge(Fuzzer *F, FuzzingOptions &Options, const Vector<std::string> &Args,
|
|||
std::sort(NewCorpus.begin(), NewCorpus.end());
|
||||
|
||||
std::string CFPath = CFPathOrNull ? CFPathOrNull : TempPath("Merge", ".txt");
|
||||
Vector<std::string> NewFiles;
|
||||
Set<uint32_t> NewFeatures, NewCov;
|
||||
std::vector<std::string> NewFiles;
|
||||
std::set<uint32_t> NewFeatures, NewCov;
|
||||
CrashResistantMerge(Args, OldCorpus, NewCorpus, &NewFiles, {}, &NewFeatures,
|
||||
{}, &NewCov, CFPath, true);
|
||||
for (auto &Path : NewFiles)
|
||||
|
@ -531,17 +533,17 @@ void Merge(Fuzzer *F, FuzzingOptions &Options, const Vector<std::string> &Args,
|
|||
exit(0);
|
||||
}
|
||||
|
||||
int AnalyzeDictionary(Fuzzer *F, const Vector<Unit>& Dict,
|
||||
UnitVector& Corpus) {
|
||||
int AnalyzeDictionary(Fuzzer *F, const std::vector<Unit> &Dict,
|
||||
UnitVector &Corpus) {
|
||||
Printf("Started dictionary minimization (up to %d tests)\n",
|
||||
Dict.size() * Corpus.size() * 2);
|
||||
|
||||
// Scores and usage count for each dictionary unit.
|
||||
Vector<int> Scores(Dict.size());
|
||||
Vector<int> Usages(Dict.size());
|
||||
std::vector<int> Scores(Dict.size());
|
||||
std::vector<int> Usages(Dict.size());
|
||||
|
||||
Vector<size_t> InitialFeatures;
|
||||
Vector<size_t> ModifiedFeatures;
|
||||
std::vector<size_t> InitialFeatures;
|
||||
std::vector<size_t> ModifiedFeatures;
|
||||
for (auto &C : Corpus) {
|
||||
// Get coverage for the testcase without modifications.
|
||||
F->ExecuteCallback(C.data(), C.size());
|
||||
|
@ -551,7 +553,7 @@ int AnalyzeDictionary(Fuzzer *F, const Vector<Unit>& Dict,
|
|||
});
|
||||
|
||||
for (size_t i = 0; i < Dict.size(); ++i) {
|
||||
Vector<uint8_t> Data = C;
|
||||
std::vector<uint8_t> Data = C;
|
||||
auto StartPos = std::search(Data.begin(), Data.end(),
|
||||
Dict[i].begin(), Dict[i].end());
|
||||
// Skip dictionary unit, if the testcase does not contain it.
|
||||
|
@ -597,9 +599,9 @@ int AnalyzeDictionary(Fuzzer *F, const Vector<Unit>& Dict,
|
|||
return 0;
|
||||
}
|
||||
|
||||
Vector<std::string> ParseSeedInuts(const char *seed_inputs) {
|
||||
std::vector<std::string> ParseSeedInuts(const char *seed_inputs) {
|
||||
// Parse -seed_inputs=file1,file2,... or -seed_inputs=@seed_inputs_file
|
||||
Vector<std::string> Files;
|
||||
std::vector<std::string> Files;
|
||||
if (!seed_inputs) return Files;
|
||||
std::string SeedInputs;
|
||||
if (Flags.seed_inputs[0] == '@')
|
||||
|
@ -620,9 +622,10 @@ Vector<std::string> ParseSeedInuts(const char *seed_inputs) {
|
|||
return Files;
|
||||
}
|
||||
|
||||
static Vector<SizedFile> ReadCorpora(const Vector<std::string> &CorpusDirs,
|
||||
const Vector<std::string> &ExtraSeedFiles) {
|
||||
Vector<SizedFile> SizedFiles;
|
||||
static std::vector<SizedFile>
|
||||
ReadCorpora(const std::vector<std::string> &CorpusDirs,
|
||||
const std::vector<std::string> &ExtraSeedFiles) {
|
||||
std::vector<SizedFile> SizedFiles;
|
||||
size_t LastNumFiles = 0;
|
||||
for (auto &Dir : CorpusDirs) {
|
||||
GetSizedFilesFromDir(Dir, &SizedFiles);
|
||||
|
@ -645,7 +648,7 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
|
|||
EF->LLVMFuzzerInitialize(argc, argv);
|
||||
if (EF->__msan_scoped_disable_interceptor_checks)
|
||||
EF->__msan_scoped_disable_interceptor_checks();
|
||||
const Vector<std::string> Args(*argv, *argv + *argc);
|
||||
const std::vector<std::string> Args(*argv, *argv + *argc);
|
||||
assert(!Args.empty());
|
||||
ProgName = new std::string(Args[0]);
|
||||
if (Argv0 != *ProgName) {
|
||||
|
@ -734,7 +737,7 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
|
|||
ValidateDirectoryExists(DirName(Options.ExactArtifactPath),
|
||||
Flags.create_missing_dirs);
|
||||
}
|
||||
Vector<Unit> Dictionary;
|
||||
std::vector<Unit> Dictionary;
|
||||
if (Flags.dict)
|
||||
if (!ParseDictionaryFile(FileToString(Flags.dict), &Dictionary))
|
||||
return 1;
|
||||
|
|
|
@ -86,15 +86,15 @@ struct FuzzJob {
|
|||
};
|
||||
|
||||
struct GlobalEnv {
|
||||
Vector<std::string> Args;
|
||||
Vector<std::string> CorpusDirs;
|
||||
std::vector<std::string> Args;
|
||||
std::vector<std::string> CorpusDirs;
|
||||
std::string MainCorpusDir;
|
||||
std::string TempDir;
|
||||
std::string DFTDir;
|
||||
std::string DataFlowBinary;
|
||||
Set<uint32_t> Features, Cov;
|
||||
Set<std::string> FilesWithDFT;
|
||||
Vector<std::string> Files;
|
||||
std::set<uint32_t> Features, Cov;
|
||||
std::set<std::string> FilesWithDFT;
|
||||
std::vector<std::string> Files;
|
||||
Random *Rand;
|
||||
std::chrono::system_clock::time_point ProcessStartTime;
|
||||
int Verbosity = 0;
|
||||
|
@ -183,7 +183,7 @@ struct GlobalEnv {
|
|||
auto Stats = ParseFinalStatsFromLog(Job->LogPath);
|
||||
NumRuns += Stats.number_of_executed_units;
|
||||
|
||||
Vector<SizedFile> TempFiles, MergeCandidates;
|
||||
std::vector<SizedFile> TempFiles, MergeCandidates;
|
||||
// Read all newly created inputs and their feature sets.
|
||||
// Choose only those inputs that have new features.
|
||||
GetSizedFilesFromDir(Job->CorpusDir, &TempFiles);
|
||||
|
@ -193,7 +193,7 @@ struct GlobalEnv {
|
|||
FeatureFile.replace(0, Job->CorpusDir.size(), Job->FeaturesDir);
|
||||
auto FeatureBytes = FileToVector(FeatureFile, 0, false);
|
||||
assert((FeatureBytes.size() % sizeof(uint32_t)) == 0);
|
||||
Vector<uint32_t> NewFeatures(FeatureBytes.size() / sizeof(uint32_t));
|
||||
std::vector<uint32_t> NewFeatures(FeatureBytes.size() / sizeof(uint32_t));
|
||||
memcpy(NewFeatures.data(), FeatureBytes.data(), FeatureBytes.size());
|
||||
for (auto Ft : NewFeatures) {
|
||||
if (!Features.count(Ft)) {
|
||||
|
@ -211,8 +211,8 @@ struct GlobalEnv {
|
|||
|
||||
if (MergeCandidates.empty()) return;
|
||||
|
||||
Vector<std::string> FilesToAdd;
|
||||
Set<uint32_t> NewFeatures, NewCov;
|
||||
std::vector<std::string> FilesToAdd;
|
||||
std::set<uint32_t> NewFeatures, NewCov;
|
||||
CrashResistantMerge(Args, {}, MergeCandidates, &FilesToAdd, Features,
|
||||
&NewFeatures, Cov, &NewCov, Job->CFPath, false);
|
||||
for (auto &Path : FilesToAdd) {
|
||||
|
@ -283,8 +283,8 @@ void WorkerThread(JobQueue *FuzzQ, JobQueue *MergeQ) {
|
|||
|
||||
// This is just a skeleton of an experimental -fork=1 feature.
|
||||
void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,
|
||||
const Vector<std::string> &Args,
|
||||
const Vector<std::string> &CorpusDirs, int NumJobs) {
|
||||
const std::vector<std::string> &Args,
|
||||
const std::vector<std::string> &CorpusDirs, int NumJobs) {
|
||||
Printf("INFO: -fork=%d: fuzzing in separate process(s)\n", NumJobs);
|
||||
|
||||
GlobalEnv Env;
|
||||
|
@ -295,7 +295,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,
|
|||
Env.ProcessStartTime = std::chrono::system_clock::now();
|
||||
Env.DataFlowBinary = Options.CollectDataFlow;
|
||||
|
||||
Vector<SizedFile> SeedFiles;
|
||||
std::vector<SizedFile> SeedFiles;
|
||||
for (auto &Dir : CorpusDirs)
|
||||
GetSizedFilesFromDir(Dir, &SeedFiles);
|
||||
std::sort(SeedFiles.begin(), SeedFiles.end());
|
||||
|
@ -316,7 +316,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,
|
|||
Env.Files.push_back(File.File);
|
||||
} else {
|
||||
auto CFPath = DirPlusFile(Env.TempDir, "merge.txt");
|
||||
Set<uint32_t> NewFeatures, NewCov;
|
||||
std::set<uint32_t> NewFeatures, NewCov;
|
||||
CrashResistantMerge(Env.Args, {}, SeedFiles, &Env.Files, Env.Features,
|
||||
&NewFeatures, Env.Cov, &NewCov, CFPath, false);
|
||||
Env.Features.insert(NewFeatures.begin(), NewFeatures.end());
|
||||
|
@ -338,7 +338,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,
|
|||
};
|
||||
|
||||
size_t JobId = 1;
|
||||
Vector<std::thread> Threads;
|
||||
std::vector<std::thread> Threads;
|
||||
for (int t = 0; t < NumJobs; t++) {
|
||||
Threads.push_back(std::thread(WorkerThread, &FuzzQ, &MergeQ));
|
||||
FuzzQ.Push(Env.CreateNewJob(JobId++));
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace fuzzer {
|
||||
void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,
|
||||
const Vector<std::string> &Args,
|
||||
const Vector<std::string> &CorpusDirs, int NumJobs);
|
||||
const std::vector<std::string> &Args,
|
||||
const std::vector<std::string> &CorpusDirs, int NumJobs);
|
||||
} // namespace fuzzer
|
||||
|
||||
#endif // LLVM_FUZZER_FORK_H
|
||||
|
|
|
@ -90,11 +90,11 @@ void AppendToFile(const uint8_t *Data, size_t Size, const std::string &Path) {
|
|||
fclose(Out);
|
||||
}
|
||||
|
||||
void ReadDirToVectorOfUnits(const char *Path, Vector<Unit> *V, long *Epoch,
|
||||
void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V, long *Epoch,
|
||||
size_t MaxSize, bool ExitOnError,
|
||||
Vector<std::string> *VPaths) {
|
||||
std::vector<std::string> *VPaths) {
|
||||
long E = Epoch ? *Epoch : 0;
|
||||
Vector<std::string> Files;
|
||||
std::vector<std::string> Files;
|
||||
ListFilesInDirRecursive(Path, Epoch, &Files, /*TopDir*/true);
|
||||
size_t NumLoaded = 0;
|
||||
for (size_t i = 0; i < Files.size(); i++) {
|
||||
|
@ -112,8 +112,8 @@ void ReadDirToVectorOfUnits(const char *Path, Vector<Unit> *V, long *Epoch,
|
|||
}
|
||||
}
|
||||
|
||||
void GetSizedFilesFromDir(const std::string &Dir, Vector<SizedFile> *V) {
|
||||
Vector<std::string> Files;
|
||||
void GetSizedFilesFromDir(const std::string &Dir, std::vector<SizedFile> *V) {
|
||||
std::vector<std::string> Files;
|
||||
ListFilesInDirRecursive(Dir, 0, &Files, /*TopDir*/true);
|
||||
for (auto &File : Files)
|
||||
if (size_t Size = FileSize(File))
|
||||
|
|
|
@ -32,9 +32,9 @@ void WriteToFile(const Unit &U, const std::string &Path);
|
|||
void AppendToFile(const uint8_t *Data, size_t Size, const std::string &Path);
|
||||
void AppendToFile(const std::string &Data, const std::string &Path);
|
||||
|
||||
void ReadDirToVectorOfUnits(const char *Path, Vector<Unit> *V, long *Epoch,
|
||||
void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V, long *Epoch,
|
||||
size_t MaxSize, bool ExitOnError,
|
||||
Vector<std::string> *VPaths = 0);
|
||||
std::vector<std::string> *VPaths = 0);
|
||||
|
||||
// Returns "Dir/FileName" or equivalent for the current OS.
|
||||
std::string DirPlusFile(const std::string &DirPath,
|
||||
|
@ -66,7 +66,7 @@ bool IsDirectory(const std::string &Path);
|
|||
size_t FileSize(const std::string &Path);
|
||||
|
||||
void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
|
||||
Vector<std::string> *V, bool TopDir);
|
||||
std::vector<std::string> *V, bool TopDir);
|
||||
|
||||
bool MkDirRecursive(const std::string &Dir);
|
||||
void RmDirRecursive(const std::string &Dir);
|
||||
|
@ -85,7 +85,7 @@ struct SizedFile {
|
|||
bool operator<(const SizedFile &B) const { return Size < B.Size; }
|
||||
};
|
||||
|
||||
void GetSizedFilesFromDir(const std::string &Dir, Vector<SizedFile> *V);
|
||||
void GetSizedFilesFromDir(const std::string &Dir, std::vector<SizedFile> *V);
|
||||
|
||||
char GetSeparator();
|
||||
bool IsSeparator(char C);
|
||||
|
|
|
@ -53,7 +53,7 @@ std::string Basename(const std::string &Path) {
|
|||
}
|
||||
|
||||
void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
|
||||
Vector<std::string> *V, bool TopDir) {
|
||||
std::vector<std::string> *V, bool TopDir) {
|
||||
auto E = GetEpoch(Dir);
|
||||
if (Epoch)
|
||||
if (E && *Epoch >= E) return;
|
||||
|
@ -78,7 +78,6 @@ void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
|
|||
*Epoch = E;
|
||||
}
|
||||
|
||||
|
||||
void IterateDirRecursive(const std::string &Dir,
|
||||
void (*DirPreCallback)(const std::string &Dir),
|
||||
void (*DirPostCallback)(const std::string &Dir),
|
||||
|
|
|
@ -111,7 +111,7 @@ size_t FileSize(const std::string &Path) {
|
|||
}
|
||||
|
||||
void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
|
||||
Vector<std::string> *V, bool TopDir) {
|
||||
std::vector<std::string> *V, bool TopDir) {
|
||||
auto E = GetEpoch(Dir);
|
||||
if (Epoch)
|
||||
if (E && *Epoch >= E) return;
|
||||
|
@ -159,7 +159,6 @@ void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
|
|||
*Epoch = E;
|
||||
}
|
||||
|
||||
|
||||
void IterateDirRecursive(const std::string &Dir,
|
||||
void (*DirPreCallback)(const std::string &Dir),
|
||||
void (*DirPostCallback)(const std::string &Dir),
|
||||
|
@ -297,9 +296,8 @@ static size_t ParseServerAndShare(const std::string &FileName,
|
|||
return Pos - Offset;
|
||||
}
|
||||
|
||||
// Parse the given Ref string from the position Offset, to exactly match the given
|
||||
// string Patt.
|
||||
// Returns number of characters considered if successful.
|
||||
// Parse the given Ref string from the position Offset, to exactly match the
|
||||
// given string Patt. Returns number of characters considered if successful.
|
||||
static size_t ParseCustomString(const std::string &Ref, size_t Offset,
|
||||
const char *Patt) {
|
||||
size_t Len = strlen(Patt);
|
||||
|
|
|
@ -35,8 +35,8 @@ public:
|
|||
Fuzzer(UserCallback CB, InputCorpus &Corpus, MutationDispatcher &MD,
|
||||
FuzzingOptions Options);
|
||||
~Fuzzer();
|
||||
void Loop(Vector<SizedFile> &CorporaFiles);
|
||||
void ReadAndExecuteSeedCorpora(Vector<SizedFile> &CorporaFiles);
|
||||
void Loop(std::vector<SizedFile> &CorporaFiles);
|
||||
void ReadAndExecuteSeedCorpora(std::vector<SizedFile> &CorporaFiles);
|
||||
void MinimizeCrashLoop(const Unit &U);
|
||||
void RereadOutputCorpus(size_t MaxSize);
|
||||
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
void TPCUpdateObservedPCs();
|
||||
|
||||
// Merge Corpora[1:] into Corpora[0].
|
||||
void Merge(const Vector<std::string> &Corpora);
|
||||
void Merge(const std::vector<std::string> &Corpora);
|
||||
void CrashResistantMergeInternalStep(const std::string &ControlFilePath);
|
||||
MutationDispatcher &GetMD() { return MD; }
|
||||
void PrintFinalStats();
|
||||
|
@ -141,7 +141,7 @@ private:
|
|||
size_t MaxMutationLen = 0;
|
||||
size_t TmpMaxMutationLen = 0;
|
||||
|
||||
Vector<uint32_t> UniqFeatureSetTmp;
|
||||
std::vector<uint32_t> UniqFeatureSetTmp;
|
||||
|
||||
// Need to know our own thread.
|
||||
static thread_local bool IsMyThread;
|
||||
|
|
|
@ -388,7 +388,7 @@ void Fuzzer::SetMaxMutationLen(size_t MaxMutationLen) {
|
|||
|
||||
void Fuzzer::CheckExitOnSrcPosOrItem() {
|
||||
if (!Options.ExitOnSrcPos.empty()) {
|
||||
static auto *PCsSet = new Set<uintptr_t>;
|
||||
static auto *PCsSet = new std::set<uintptr_t>;
|
||||
auto HandlePC = [&](const TracePC::PCTableEntry *TE) {
|
||||
if (!PCsSet->insert(TE->PC).second)
|
||||
return;
|
||||
|
@ -413,8 +413,8 @@ void Fuzzer::CheckExitOnSrcPosOrItem() {
|
|||
void Fuzzer::RereadOutputCorpus(size_t MaxSize) {
|
||||
if (Options.OutputCorpus.empty() || !Options.ReloadIntervalSec)
|
||||
return;
|
||||
Vector<Unit> AdditionalCorpus;
|
||||
Vector<std::string> AdditionalCorpusPaths;
|
||||
std::vector<Unit> AdditionalCorpus;
|
||||
std::vector<std::string> AdditionalCorpusPaths;
|
||||
ReadDirToVectorOfUnits(
|
||||
Options.OutputCorpus.c_str(), &AdditionalCorpus,
|
||||
&EpochOfLastReadOfOutputCorpus, MaxSize,
|
||||
|
@ -457,7 +457,7 @@ void Fuzzer::PrintPulseAndReportSlowInput(const uint8_t *Data, size_t Size) {
|
|||
|
||||
static void WriteFeatureSetToFile(const std::string &FeaturesDir,
|
||||
const std::string &FileName,
|
||||
const Vector<uint32_t> &FeatureSet) {
|
||||
const std::vector<uint32_t> &FeatureSet) {
|
||||
if (FeaturesDir.empty() || FeatureSet.empty()) return;
|
||||
WriteToFile(reinterpret_cast<const uint8_t *>(FeatureSet.data()),
|
||||
FeatureSet.size() * sizeof(FeatureSet[0]),
|
||||
|
@ -784,7 +784,7 @@ void Fuzzer::PurgeAllocator() {
|
|||
LastAllocatorPurgeAttemptTime = system_clock::now();
|
||||
}
|
||||
|
||||
void Fuzzer::ReadAndExecuteSeedCorpora(Vector<SizedFile> &CorporaFiles) {
|
||||
void Fuzzer::ReadAndExecuteSeedCorpora(std::vector<SizedFile> &CorporaFiles) {
|
||||
const size_t kMaxSaneLen = 1 << 20;
|
||||
const size_t kMinDefaultLen = 4096;
|
||||
size_t MaxSize = 0;
|
||||
|
@ -849,7 +849,7 @@ void Fuzzer::ReadAndExecuteSeedCorpora(Vector<SizedFile> &CorporaFiles) {
|
|||
}
|
||||
}
|
||||
|
||||
void Fuzzer::Loop(Vector<SizedFile> &CorporaFiles) {
|
||||
void Fuzzer::Loop(std::vector<SizedFile> &CorporaFiles) {
|
||||
auto FocusFunctionOrAuto = Options.FocusFunction;
|
||||
DFT.Init(Options.DataFlowTrace, &FocusFunctionOrAuto, CorporaFiles,
|
||||
MD.GetRand());
|
||||
|
|
|
@ -77,8 +77,8 @@ bool Merger::Parse(std::istream &IS, bool ParseCoverage) {
|
|||
size_t ExpectedStartMarker = 0;
|
||||
const size_t kInvalidStartMarker = -1;
|
||||
size_t LastSeenStartMarker = kInvalidStartMarker;
|
||||
Vector<uint32_t> TmpFeatures;
|
||||
Set<uint32_t> PCs;
|
||||
std::vector<uint32_t> TmpFeatures;
|
||||
std::set<uint32_t> PCs;
|
||||
while (std::getline(IS, Line, '\n')) {
|
||||
std::istringstream ISS1(Line);
|
||||
std::string Marker;
|
||||
|
@ -132,15 +132,16 @@ size_t Merger::ApproximateMemoryConsumption() const {
|
|||
|
||||
// Decides which files need to be merged (add those to NewFiles).
|
||||
// Returns the number of new features added.
|
||||
size_t Merger::Merge(const Set<uint32_t> &InitialFeatures,
|
||||
Set<uint32_t> *NewFeatures,
|
||||
const Set<uint32_t> &InitialCov, Set<uint32_t> *NewCov,
|
||||
Vector<std::string> *NewFiles) {
|
||||
size_t Merger::Merge(const std::set<uint32_t> &InitialFeatures,
|
||||
std::set<uint32_t> *NewFeatures,
|
||||
const std::set<uint32_t> &InitialCov,
|
||||
std::set<uint32_t> *NewCov,
|
||||
std::vector<std::string> *NewFiles) {
|
||||
NewFiles->clear();
|
||||
NewFeatures->clear();
|
||||
NewCov->clear();
|
||||
assert(NumFilesInFirstCorpus <= Files.size());
|
||||
Set<uint32_t> AllFeatures = InitialFeatures;
|
||||
std::set<uint32_t> AllFeatures = InitialFeatures;
|
||||
|
||||
// What features are in the initial corpus?
|
||||
for (size_t i = 0; i < NumFilesInFirstCorpus; i++) {
|
||||
|
@ -150,7 +151,7 @@ size_t Merger::Merge(const Set<uint32_t> &InitialFeatures,
|
|||
// Remove all features that we already know from all other inputs.
|
||||
for (size_t i = NumFilesInFirstCorpus; i < Files.size(); i++) {
|
||||
auto &Cur = Files[i].Features;
|
||||
Vector<uint32_t> Tmp;
|
||||
std::vector<uint32_t> Tmp;
|
||||
std::set_difference(Cur.begin(), Cur.end(), AllFeatures.begin(),
|
||||
AllFeatures.end(), std::inserter(Tmp, Tmp.begin()));
|
||||
Cur.swap(Tmp);
|
||||
|
@ -188,8 +189,8 @@ size_t Merger::Merge(const Set<uint32_t> &InitialFeatures,
|
|||
return NewFeatures->size();
|
||||
}
|
||||
|
||||
Set<uint32_t> Merger::AllFeatures() const {
|
||||
Set<uint32_t> S;
|
||||
std::set<uint32_t> Merger::AllFeatures() const {
|
||||
std::set<uint32_t> S;
|
||||
for (auto &File : Files)
|
||||
S.insert(File.Features.begin(), File.Features.end());
|
||||
return S;
|
||||
|
@ -212,11 +213,11 @@ void Fuzzer::CrashResistantMergeInternalStep(const std::string &CFPath) {
|
|||
M.Files.size() - M.FirstNotProcessedFile);
|
||||
|
||||
std::ofstream OF(CFPath, std::ofstream::out | std::ofstream::app);
|
||||
Set<size_t> AllFeatures;
|
||||
std::set<size_t> AllFeatures;
|
||||
auto PrintStatsWrapper = [this, &AllFeatures](const char* Where) {
|
||||
this->PrintStats(Where, "\n", 0, AllFeatures.size());
|
||||
};
|
||||
Set<const TracePC::PCTableEntry *> AllPCs;
|
||||
std::set<const TracePC::PCTableEntry *> AllPCs;
|
||||
for (size_t i = M.FirstNotProcessedFile; i < M.Files.size(); i++) {
|
||||
Fuzzer::MaybeExitGracefully();
|
||||
auto U = FileToVector(M.Files[i].Name);
|
||||
|
@ -236,7 +237,7 @@ void Fuzzer::CrashResistantMergeInternalStep(const std::string &CFPath) {
|
|||
// * Then, all other files, smallest first.
|
||||
// So it makes no sense to record all features for all files, instead we
|
||||
// only record features that were not seen before.
|
||||
Set<size_t> UniqFeatures;
|
||||
std::set<size_t> UniqFeatures;
|
||||
TPC.CollectFeatures([&](size_t Feature) {
|
||||
if (AllFeatures.insert(Feature).second)
|
||||
UniqFeatures.insert(Feature);
|
||||
|
@ -263,15 +264,16 @@ void Fuzzer::CrashResistantMergeInternalStep(const std::string &CFPath) {
|
|||
PrintStatsWrapper("DONE ");
|
||||
}
|
||||
|
||||
static size_t WriteNewControlFile(const std::string &CFPath,
|
||||
const Vector<SizedFile> &OldCorpus,
|
||||
const Vector<SizedFile> &NewCorpus,
|
||||
const Vector<MergeFileInfo> &KnownFiles) {
|
||||
static size_t
|
||||
WriteNewControlFile(const std::string &CFPath,
|
||||
const std::vector<SizedFile> &OldCorpus,
|
||||
const std::vector<SizedFile> &NewCorpus,
|
||||
const std::vector<MergeFileInfo> &KnownFiles) {
|
||||
std::unordered_set<std::string> FilesToSkip;
|
||||
for (auto &SF: KnownFiles)
|
||||
FilesToSkip.insert(SF.Name);
|
||||
|
||||
Vector<std::string> FilesToUse;
|
||||
std::vector<std::string> FilesToUse;
|
||||
auto MaybeUseFile = [=, &FilesToUse](std::string Name) {
|
||||
if (FilesToSkip.find(Name) == FilesToSkip.end())
|
||||
FilesToUse.push_back(Name);
|
||||
|
@ -299,19 +301,18 @@ static size_t WriteNewControlFile(const std::string &CFPath,
|
|||
}
|
||||
|
||||
// Outer process. Does not call the target code and thus should not fail.
|
||||
void CrashResistantMerge(const Vector<std::string> &Args,
|
||||
const Vector<SizedFile> &OldCorpus,
|
||||
const Vector<SizedFile> &NewCorpus,
|
||||
Vector<std::string> *NewFiles,
|
||||
const Set<uint32_t> &InitialFeatures,
|
||||
Set<uint32_t> *NewFeatures,
|
||||
const Set<uint32_t> &InitialCov,
|
||||
Set<uint32_t> *NewCov,
|
||||
const std::string &CFPath,
|
||||
void CrashResistantMerge(const std::vector<std::string> &Args,
|
||||
const std::vector<SizedFile> &OldCorpus,
|
||||
const std::vector<SizedFile> &NewCorpus,
|
||||
std::vector<std::string> *NewFiles,
|
||||
const std::set<uint32_t> &InitialFeatures,
|
||||
std::set<uint32_t> *NewFeatures,
|
||||
const std::set<uint32_t> &InitialCov,
|
||||
std::set<uint32_t> *NewCov, const std::string &CFPath,
|
||||
bool V /*Verbose*/) {
|
||||
if (NewCorpus.empty() && OldCorpus.empty()) return; // Nothing to merge.
|
||||
size_t NumAttempts = 0;
|
||||
Vector<MergeFileInfo> KnownFiles;
|
||||
std::vector<MergeFileInfo> KnownFiles;
|
||||
if (FileSize(CFPath)) {
|
||||
VPrintf(V, "MERGE-OUTER: non-empty control file provided: '%s'\n",
|
||||
CFPath.c_str());
|
||||
|
|
|
@ -52,11 +52,11 @@ namespace fuzzer {
|
|||
struct MergeFileInfo {
|
||||
std::string Name;
|
||||
size_t Size = 0;
|
||||
Vector<uint32_t> Features, Cov;
|
||||
std::vector<uint32_t> Features, Cov;
|
||||
};
|
||||
|
||||
struct Merger {
|
||||
Vector<MergeFileInfo> Files;
|
||||
std::vector<MergeFileInfo> Files;
|
||||
size_t NumFilesInFirstCorpus = 0;
|
||||
size_t FirstNotProcessedFile = 0;
|
||||
std::string LastFailure;
|
||||
|
@ -64,22 +64,22 @@ struct Merger {
|
|||
bool Parse(std::istream &IS, bool ParseCoverage);
|
||||
bool Parse(const std::string &Str, bool ParseCoverage);
|
||||
void ParseOrExit(std::istream &IS, bool ParseCoverage);
|
||||
size_t Merge(const Set<uint32_t> &InitialFeatures, Set<uint32_t> *NewFeatures,
|
||||
const Set<uint32_t> &InitialCov, Set<uint32_t> *NewCov,
|
||||
Vector<std::string> *NewFiles);
|
||||
size_t Merge(const std::set<uint32_t> &InitialFeatures,
|
||||
std::set<uint32_t> *NewFeatures,
|
||||
const std::set<uint32_t> &InitialCov, std::set<uint32_t> *NewCov,
|
||||
std::vector<std::string> *NewFiles);
|
||||
size_t ApproximateMemoryConsumption() const;
|
||||
Set<uint32_t> AllFeatures() const;
|
||||
std::set<uint32_t> AllFeatures() const;
|
||||
};
|
||||
|
||||
void CrashResistantMerge(const Vector<std::string> &Args,
|
||||
const Vector<SizedFile> &OldCorpus,
|
||||
const Vector<SizedFile> &NewCorpus,
|
||||
Vector<std::string> *NewFiles,
|
||||
const Set<uint32_t> &InitialFeatures,
|
||||
Set<uint32_t> *NewFeatures,
|
||||
const Set<uint32_t> &InitialCov,
|
||||
Set<uint32_t> *NewCov,
|
||||
const std::string &CFPath,
|
||||
void CrashResistantMerge(const std::vector<std::string> &Args,
|
||||
const std::vector<SizedFile> &OldCorpus,
|
||||
const std::vector<SizedFile> &NewCorpus,
|
||||
std::vector<std::string> *NewFiles,
|
||||
const std::set<uint32_t> &InitialFeatures,
|
||||
std::set<uint32_t> *NewFeatures,
|
||||
const std::set<uint32_t> &InitialCov,
|
||||
std::set<uint32_t> *NewCov, const std::string &CFPath,
|
||||
bool Verbose);
|
||||
|
||||
} // namespace fuzzer
|
||||
|
|
|
@ -485,7 +485,7 @@ void MutationDispatcher::RecordSuccessfulMutationSequence() {
|
|||
}
|
||||
|
||||
void MutationDispatcher::PrintRecommendedDictionary() {
|
||||
Vector<DictionaryEntry> V;
|
||||
std::vector<DictionaryEntry> V;
|
||||
for (auto &DE : PersistentAutoDictionary)
|
||||
if (!ManualDictionary.ContainsWord(DE.GetW()))
|
||||
V.push_back(DE);
|
||||
|
@ -540,7 +540,7 @@ size_t MutationDispatcher::DefaultMutate(uint8_t *Data, size_t Size,
|
|||
// Mutates Data in place, returns new size.
|
||||
size_t MutationDispatcher::MutateImpl(uint8_t *Data, size_t Size,
|
||||
size_t MaxSize,
|
||||
Vector<Mutator> &Mutators) {
|
||||
std::vector<Mutator> &Mutators) {
|
||||
assert(MaxSize > 0);
|
||||
// Some mutations may fail (e.g. can't insert more bytes if Size == MaxSize),
|
||||
// in which case they will return 0.
|
||||
|
@ -562,7 +562,7 @@ size_t MutationDispatcher::MutateImpl(uint8_t *Data, size_t Size,
|
|||
// Mask represents the set of Data bytes that are worth mutating.
|
||||
size_t MutationDispatcher::MutateWithMask(uint8_t *Data, size_t Size,
|
||||
size_t MaxSize,
|
||||
const Vector<uint8_t> &Mask) {
|
||||
const std::vector<uint8_t> &Mask) {
|
||||
size_t MaskedSize = std::min(Size, Mask.size());
|
||||
// * Copy the worthy bytes into a temporary array T
|
||||
// * Mutate T
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
/// that have '1' in Mask.
|
||||
/// Mask.size() should be >= Size.
|
||||
size_t MutateWithMask(uint8_t *Data, size_t Size, size_t MaxSize,
|
||||
const Vector<uint8_t> &Mask);
|
||||
const std::vector<uint8_t> &Mask);
|
||||
|
||||
/// Applies one of the default mutations. Provided as a service
|
||||
/// to mutation authors.
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
size_t AddWordFromDictionary(Dictionary &D, uint8_t *Data, size_t Size,
|
||||
size_t MaxSize);
|
||||
size_t MutateImpl(uint8_t *Data, size_t Size, size_t MaxSize,
|
||||
Vector<Mutator> &Mutators);
|
||||
std::vector<Mutator> &Mutators);
|
||||
|
||||
size_t InsertPartOf(const uint8_t *From, size_t FromSize, uint8_t *To,
|
||||
size_t ToSize, size_t MaxToSize);
|
||||
|
@ -133,22 +133,22 @@ public:
|
|||
// entries that led to successful discoveries in the past mutations.
|
||||
Dictionary PersistentAutoDictionary;
|
||||
|
||||
Vector<DictionaryEntry *> CurrentDictionaryEntrySequence;
|
||||
std::vector<DictionaryEntry *> CurrentDictionaryEntrySequence;
|
||||
|
||||
static const size_t kCmpDictionaryEntriesDequeSize = 16;
|
||||
DictionaryEntry CmpDictionaryEntriesDeque[kCmpDictionaryEntriesDequeSize];
|
||||
size_t CmpDictionaryEntriesDequeIdx = 0;
|
||||
|
||||
const Unit *CrossOverWith = nullptr;
|
||||
Vector<uint8_t> MutateInPlaceHere;
|
||||
Vector<uint8_t> MutateWithMaskTemp;
|
||||
std::vector<uint8_t> MutateInPlaceHere;
|
||||
std::vector<uint8_t> MutateWithMaskTemp;
|
||||
// CustomCrossOver needs its own buffer as a custom implementation may call
|
||||
// LLVMFuzzerMutate, which in turn may resize MutateInPlaceHere.
|
||||
Vector<uint8_t> CustomCrossOverInPlaceHere;
|
||||
std::vector<uint8_t> CustomCrossOverInPlaceHere;
|
||||
|
||||
Vector<Mutator> Mutators;
|
||||
Vector<Mutator> DefaultMutators;
|
||||
Vector<Mutator> CurrentMutatorSequence;
|
||||
std::vector<Mutator> Mutators;
|
||||
std::vector<Mutator> DefaultMutators;
|
||||
std::vector<Mutator> CurrentMutatorSequence;
|
||||
};
|
||||
|
||||
} // namespace fuzzer
|
||||
|
|
|
@ -157,7 +157,7 @@ ALWAYS_INLINE uintptr_t TracePC::GetNextInstructionPc(uintptr_t PC) {
|
|||
}
|
||||
|
||||
void TracePC::UpdateObservedPCs() {
|
||||
Vector<uintptr_t> CoveredFuncs;
|
||||
std::vector<uintptr_t> CoveredFuncs;
|
||||
auto ObservePC = [&](const PCTableEntry *TE) {
|
||||
if (ObservedPCs.insert(TE).second && DoPrintNewPCs) {
|
||||
PrintPC("\tNEW_PC: %p %F %L", "\tNEW_PC: %p",
|
||||
|
@ -300,8 +300,8 @@ void TracePC::PrintCoverage(bool PrintAllCounters) {
|
|||
FunctionStr = FunctionStr.substr(3);
|
||||
std::string LineStr = DescribePC("%l", VisualizePC);
|
||||
size_t NumEdges = Last - First;
|
||||
Vector<uintptr_t> UncoveredPCs;
|
||||
Vector<uintptr_t> CoveredPCs;
|
||||
std::vector<uintptr_t> UncoveredPCs;
|
||||
std::vector<uintptr_t> CoveredPCs;
|
||||
for (auto TE = First; TE < Last; TE++)
|
||||
if (!ObservedPCs.count(TE))
|
||||
UncoveredPCs.push_back(TE->PC);
|
||||
|
|
|
@ -169,7 +169,7 @@ private:
|
|||
size_t NumPCTables;
|
||||
size_t NumPCsInPCTables;
|
||||
|
||||
Set<const PCTableEntry*> ObservedPCs;
|
||||
std::set<const PCTableEntry *> ObservedPCs;
|
||||
std::unordered_map<uintptr_t, uintptr_t> ObservedFuncs; // PC => Counter.
|
||||
|
||||
uint8_t *FocusFunctionCounterPtr = nullptr;
|
||||
|
|
|
@ -124,7 +124,7 @@ bool ParseOneDictionaryEntry(const std::string &Str, Unit *U) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ParseDictionaryFile(const std::string &Text, Vector<Unit> *Units) {
|
||||
bool ParseDictionaryFile(const std::string &Text, std::vector<Unit> *Units) {
|
||||
if (Text.empty()) {
|
||||
Printf("ParseDictionaryFile: file does not exist or is empty\n");
|
||||
return false;
|
||||
|
|
|
@ -66,10 +66,10 @@ int CloseProcessPipe(FILE *F);
|
|||
const void *SearchMemory(const void *haystack, size_t haystacklen,
|
||||
const void *needle, size_t needlelen);
|
||||
|
||||
std::string CloneArgsWithoutX(const Vector<std::string> &Args,
|
||||
std::string CloneArgsWithoutX(const std::vector<std::string> &Args,
|
||||
const char *X1, const char *X2);
|
||||
|
||||
inline std::string CloneArgsWithoutX(const Vector<std::string> &Args,
|
||||
inline std::string CloneArgsWithoutX(const std::vector<std::string> &Args,
|
||||
const char *X) {
|
||||
return CloneArgsWithoutX(Args, X, X);
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ const void *SearchMemory(const void *Data, size_t DataLen, const void *Patt,
|
|||
}
|
||||
|
||||
std::string DisassembleCmd(const std::string &FileName) {
|
||||
Vector<std::string> command_vector;
|
||||
std::vector<std::string> command_vector;
|
||||
command_vector.push_back("dumpbin /summary > nul");
|
||||
if (ExecuteCommand(Command(command_vector)) == 0)
|
||||
return "dumpbin /disasm " + FileName;
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
using namespace fuzzer;
|
||||
|
||||
// For now, have LLVMFuzzerTestOneInput just to make it link.
|
||||
// Later we may want to make unittests that actually call LLVMFuzzerTestOneInput.
|
||||
// Later we may want to make unittests that actually call
|
||||
// LLVMFuzzerTestOneInput.
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
abort();
|
||||
}
|
||||
|
@ -88,7 +89,7 @@ TEST(Fuzzer, CrossOver) {
|
|||
{ 0, 5, 6, 7, 1, 2 }
|
||||
};
|
||||
for (size_t Len = 1; Len < 8; Len++) {
|
||||
Set<Unit> FoundUnits, ExpectedUnitsWitThisLength;
|
||||
std::set<Unit> FoundUnits, ExpectedUnitsWitThisLength;
|
||||
for (int Iter = 0; Iter < 3000; Iter++) {
|
||||
C.resize(Len);
|
||||
size_t NewSize = MD->CrossOver(A.data(), A.size(), B.data(), B.size(),
|
||||
|
@ -242,7 +243,8 @@ void TestInsertRepeatedBytes(Mutator M, int NumIter) {
|
|||
}
|
||||
|
||||
TEST(FuzzerMutate, InsertRepeatedBytes1) {
|
||||
TestInsertRepeatedBytes(&MutationDispatcher::Mutate_InsertRepeatedBytes, 10000);
|
||||
TestInsertRepeatedBytes(&MutationDispatcher::Mutate_InsertRepeatedBytes,
|
||||
10000);
|
||||
}
|
||||
TEST(FuzzerMutate, InsertRepeatedBytes2) {
|
||||
TestInsertRepeatedBytes(&MutationDispatcher::Mutate, 300000);
|
||||
|
@ -557,7 +559,7 @@ TEST(FuzzerDictionary, ParseOneDictionaryEntry) {
|
|||
}
|
||||
|
||||
TEST(FuzzerDictionary, ParseDictionaryFile) {
|
||||
Vector<Unit> Units;
|
||||
std::vector<Unit> Units;
|
||||
EXPECT_FALSE(ParseDictionaryFile("zzz\n", &Units));
|
||||
EXPECT_FALSE(ParseDictionaryFile("", &Units));
|
||||
EXPECT_TRUE(ParseDictionaryFile("\n", &Units));
|
||||
|
@ -569,11 +571,11 @@ TEST(FuzzerDictionary, ParseDictionaryFile) {
|
|||
EXPECT_TRUE(ParseDictionaryFile(" #zzzz\n", &Units));
|
||||
EXPECT_EQ(Units.size(), 0U);
|
||||
EXPECT_TRUE(ParseDictionaryFile(" #zzzz\naaa=\"aa\"", &Units));
|
||||
EXPECT_EQ(Units, Vector<Unit>({Unit({'a', 'a'})}));
|
||||
EXPECT_EQ(Units, std::vector<Unit>({Unit({'a', 'a'})}));
|
||||
EXPECT_TRUE(
|
||||
ParseDictionaryFile(" #zzzz\naaa=\"aa\"\n\nabc=\"abc\"", &Units));
|
||||
EXPECT_EQ(Units,
|
||||
Vector<Unit>({Unit({'a', 'a'}), Unit({'a', 'b', 'c'})}));
|
||||
std::vector<Unit>({Unit({'a', 'a'}), Unit({'a', 'b', 'c'})}));
|
||||
}
|
||||
|
||||
TEST(FuzzerUtil, Base64) {
|
||||
|
@ -604,7 +606,7 @@ TEST(Corpus, Distribution) {
|
|||
/*FeatureSet*/ {}, DFT,
|
||||
/*BaseII*/ nullptr);
|
||||
|
||||
Vector<size_t> Hist(N);
|
||||
std::vector<size_t> Hist(N);
|
||||
for (size_t i = 0; i < N * TriesPerUnit; i++) {
|
||||
Hist[C->ChooseUnitIdxToMutate(Rand)]++;
|
||||
}
|
||||
|
@ -614,19 +616,21 @@ TEST(Corpus, Distribution) {
|
|||
}
|
||||
}
|
||||
|
||||
template <typename T> void EQ(const Vector<T> &A, const Vector<T> &B) {
|
||||
template <typename T>
|
||||
void EQ(const std::vector<T> &A, const std::vector<T> &B) {
|
||||
EXPECT_EQ(A, B);
|
||||
}
|
||||
|
||||
template <typename T> void EQ(const Set<T> &A, const Vector<T> &B) {
|
||||
EXPECT_EQ(A, Set<T>(B.begin(), B.end()));
|
||||
template <typename T> void EQ(const std::set<T> &A, const std::vector<T> &B) {
|
||||
EXPECT_EQ(A, std::set<T>(B.begin(), B.end()));
|
||||
}
|
||||
|
||||
void EQ(const Vector<MergeFileInfo> &A, const Vector<std::string> &B) {
|
||||
Set<std::string> a;
|
||||
void EQ(const std::vector<MergeFileInfo> &A,
|
||||
const std::vector<std::string> &B) {
|
||||
std::set<std::string> a;
|
||||
for (const auto &File : A)
|
||||
a.insert(File.Name);
|
||||
Set<std::string> b(B.begin(), B.end());
|
||||
std::set<std::string> b(B.begin(), B.end());
|
||||
EXPECT_EQ(a, b);
|
||||
}
|
||||
|
||||
|
@ -746,9 +750,9 @@ TEST(Merger, Parse) {
|
|||
|
||||
TEST(Merger, Merge) {
|
||||
Merger M;
|
||||
Set<uint32_t> Features, NewFeatures;
|
||||
Set<uint32_t> Cov, NewCov;
|
||||
Vector<std::string> NewFiles;
|
||||
std::set<uint32_t> Features, NewFeatures;
|
||||
std::set<uint32_t> Cov, NewCov;
|
||||
std::vector<std::string> NewFiles;
|
||||
|
||||
// Adds new files and features
|
||||
EXPECT_TRUE(M.Parse("3\n0\nA\nB\nC\n"
|
||||
|
@ -968,7 +972,7 @@ TEST(Fuzzer, ForEachNonZeroByte) {
|
|||
0, 0, 0, 0, 0, 0, 0, 8,
|
||||
9, 9, 9, 9, 9, 9, 9, 9,
|
||||
};
|
||||
typedef Vector<std::pair<size_t, uint8_t> > Vec;
|
||||
typedef std::vector<std::pair<size_t, uint8_t>> Vec;
|
||||
Vec Res, Expected;
|
||||
auto CB = [&](size_t FirstFeature, size_t Idx, uint8_t V) {
|
||||
Res.push_back({FirstFeature + Idx, V});
|
||||
|
@ -993,7 +997,7 @@ TEST(Fuzzer, ForEachNonZeroByte) {
|
|||
|
||||
// FuzzerCommand unit tests. The arguments in the two helper methods below must
|
||||
// match.
|
||||
static void makeCommandArgs(Vector<std::string> *ArgsToAdd) {
|
||||
static void makeCommandArgs(std::vector<std::string> *ArgsToAdd) {
|
||||
assert(ArgsToAdd);
|
||||
ArgsToAdd->clear();
|
||||
ArgsToAdd->push_back("foo");
|
||||
|
@ -1029,7 +1033,7 @@ TEST(FuzzerCommand, Create) {
|
|||
EXPECT_EQ(CmdLine, "");
|
||||
|
||||
// Explicit constructor
|
||||
Vector<std::string> ArgsToAdd;
|
||||
std::vector<std::string> ArgsToAdd;
|
||||
makeCommandArgs(&ArgsToAdd);
|
||||
Command InitializedCmd(ArgsToAdd);
|
||||
|
||||
|
@ -1061,7 +1065,7 @@ TEST(FuzzerCommand, Create) {
|
|||
}
|
||||
|
||||
TEST(FuzzerCommand, ModifyArguments) {
|
||||
Vector<std::string> ArgsToAdd;
|
||||
std::vector<std::string> ArgsToAdd;
|
||||
makeCommandArgs(&ArgsToAdd);
|
||||
Command Cmd;
|
||||
std::string CmdLine;
|
||||
|
@ -1084,7 +1088,7 @@ TEST(FuzzerCommand, ModifyArguments) {
|
|||
}
|
||||
|
||||
TEST(FuzzerCommand, ModifyFlags) {
|
||||
Vector<std::string> ArgsToAdd;
|
||||
std::vector<std::string> ArgsToAdd;
|
||||
makeCommandArgs(&ArgsToAdd);
|
||||
Command Cmd(ArgsToAdd);
|
||||
std::string Value, CmdLine;
|
||||
|
@ -1116,7 +1120,7 @@ TEST(FuzzerCommand, ModifyFlags) {
|
|||
}
|
||||
|
||||
TEST(FuzzerCommand, SetOutput) {
|
||||
Vector<std::string> ArgsToAdd;
|
||||
std::vector<std::string> ArgsToAdd;
|
||||
makeCommandArgs(&ArgsToAdd);
|
||||
Command Cmd(ArgsToAdd);
|
||||
std::string CmdLine;
|
||||
|
@ -1196,7 +1200,8 @@ TEST(Entropic, ComputeEnergy) {
|
|||
struct EntropicOptions Entropic = {true, 0xFF, 100, false};
|
||||
std::unique_ptr<InputCorpus> C(new InputCorpus("", Entropic));
|
||||
std::unique_ptr<InputInfo> II(new InputInfo());
|
||||
Vector<std::pair<uint32_t, uint16_t>> FeatureFreqs = {{1, 3}, {2, 3}, {3, 3}};
|
||||
std::vector<std::pair<uint32_t, uint16_t>> FeatureFreqs = {
|
||||
{1, 3}, {2, 3}, {3, 3}};
|
||||
II->FeatureFreqs = FeatureFreqs;
|
||||
II->NumExecutedMutations = 0;
|
||||
II->UpdateEnergy(4, false, std::chrono::microseconds(0));
|
||||
|
|
Loading…
Reference in New Issue