aboutsummaryrefslogtreecommitdiff
path: root/custom_mutators
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2021-01-04 15:32:22 +0100
committerhexcoder- <heiko@hexco.de>2021-01-04 15:32:22 +0100
commitb7af98e94561ebe44ea37304a357b00499d1104d (patch)
tree6ba2356e8e6879ae4c528e9a4f775132868a00fc /custom_mutators
parent5cdbfeef4a84b9dc2e5f8e88ee018c6c6e72fa44 (diff)
downloadAFLplusplus-b7af98e94561ebe44ea37304a357b00499d1104d.tar.gz
code cleanups (from cppcheck mostly)
Diffstat (limited to 'custom_mutators')
-rw-r--r--custom_mutators/honggfuzz/mangle.c2
-rw-r--r--custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp10
-rw-r--r--custom_mutators/libfuzzer/FuzzerDefs.h2
-rw-r--r--custom_mutators/libfuzzer/FuzzerDictionary.h4
-rw-r--r--custom_mutators/libfuzzer/FuzzerRandom.h2
-rw-r--r--custom_mutators/libfuzzer/FuzzerTracePC.h8
6 files changed, 14 insertions, 14 deletions
diff --git a/custom_mutators/honggfuzz/mangle.c b/custom_mutators/honggfuzz/mangle.c
index c2988319..9c3d1ed4 100644
--- a/custom_mutators/honggfuzz/mangle.c
+++ b/custom_mutators/honggfuzz/mangle.c
@@ -995,7 +995,7 @@ void mangle_mangleContent(run_t *run, int speed_factor) {
}
- uint64_t changesCnt = run->global->mutate.mutationsPerRun;
+ uint64_t changesCnt;
if (speed_factor < 5) {
diff --git a/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp b/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp
index 797a52a7..489665f7 100644
--- a/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp
+++ b/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp
@@ -246,7 +246,7 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
}
- if (!NumFunctions || FocusFuncIdx == SIZE_MAX || Files.size() <= 1)
+ if (FocusFuncIdx == SIZE_MAX || Files.size() <= 1)
return false;
// Read traces.
@@ -259,8 +259,8 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
if (!CorporaHashes.count(Name)) continue; // not in the corpus.
NumTraceFiles++;
// Printf("=== %s\n", Name.c_str());
- std::ifstream IF(SF.File);
- while (std::getline(IF, L, '\n')) {
+ std::ifstream IF2(SF.File);
+ while (std::getline(IF2, L, '\n')) {
size_t FunctionNum = 0;
std::string DFTString;
@@ -314,8 +314,8 @@ 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_set<std::string> Cov;
+// std::unordered_map<size_t, Vector<uint8_t>> DFTMap;
+// std::unordered_set<std::string> Cov;
Command Cmd;
Cmd.addArgument(DFTBinary);
Cmd.addArgument(F.File);
diff --git a/custom_mutators/libfuzzer/FuzzerDefs.h b/custom_mutators/libfuzzer/FuzzerDefs.h
index 1a2752af..3952ac51 100644
--- a/custom_mutators/libfuzzer/FuzzerDefs.h
+++ b/custom_mutators/libfuzzer/FuzzerDefs.h
@@ -46,7 +46,7 @@ template<typename T>
fuzzer_allocator() = default;
template<class U>
- fuzzer_allocator(const fuzzer_allocator<U>&) {}
+ explicit fuzzer_allocator(const fuzzer_allocator<U>&) {}
template<class Other>
struct rebind { typedef fuzzer_allocator<Other> other; };
diff --git a/custom_mutators/libfuzzer/FuzzerDictionary.h b/custom_mutators/libfuzzer/FuzzerDictionary.h
index 301c5d9a..ddd2d2f1 100644
--- a/custom_mutators/libfuzzer/FuzzerDictionary.h
+++ b/custom_mutators/libfuzzer/FuzzerDictionary.h
@@ -49,7 +49,7 @@ typedef FixedWord<64> Word;
class DictionaryEntry {
public:
DictionaryEntry() {}
- DictionaryEntry(Word W) : W(W) {}
+ explicit DictionaryEntry(Word W) : W(W) {}
DictionaryEntry(Word W, size_t PositionHint) : W(W), PositionHint(PositionHint) {}
const Word &GetW() const { return W; }
@@ -92,7 +92,7 @@ class Dictionary {
assert(Idx < Size);
return DE[Idx];
}
- void push_back(DictionaryEntry DE) {
+ void push_back(const DictionaryEntry &DE) {
if (Size < kMaxDictSize)
this->DE[Size++] = DE;
}
diff --git a/custom_mutators/libfuzzer/FuzzerRandom.h b/custom_mutators/libfuzzer/FuzzerRandom.h
index 659283ee..7b1e1b1d 100644
--- a/custom_mutators/libfuzzer/FuzzerRandom.h
+++ b/custom_mutators/libfuzzer/FuzzerRandom.h
@@ -16,7 +16,7 @@
namespace fuzzer {
class Random : public std::minstd_rand {
public:
- Random(unsigned int seed) : std::minstd_rand(seed) {}
+ explicit Random(unsigned int seed) : std::minstd_rand(seed) {}
result_type operator()() { return this->std::minstd_rand::operator()(); }
size_t Rand() { return this->operator()(); }
size_t RandBool() { return Rand() % 2; }
diff --git a/custom_mutators/libfuzzer/FuzzerTracePC.h b/custom_mutators/libfuzzer/FuzzerTracePC.h
index 4601300c..a58fdf8d 100644
--- a/custom_mutators/libfuzzer/FuzzerTracePC.h
+++ b/custom_mutators/libfuzzer/FuzzerTracePC.h
@@ -145,10 +145,10 @@ private:
};
Region *Regions;
size_t NumRegions;
- uint8_t *Start() { return Regions[0].Start; }
- uint8_t *Stop() { return Regions[NumRegions - 1].Stop; }
- size_t Size() { return Stop() - Start(); }
- size_t Idx(uint8_t *P) {
+ uint8_t *Start() const { return Regions[0].Start; }
+ uint8_t *Stop() const { return Regions[NumRegions - 1].Stop; }
+ size_t Size() const { return Stop() - Start(); }
+ size_t Idx(uint8_t *P) const {
assert(P >= Start() && P < Stop());
return P - Start();
}