diff options
| author | van Hauser <vh@thc.org> | 2021-01-20 19:12:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-20 19:12:52 +0100 |
| commit | 068bef5eab942df0a133c92522f2ab81b28ac636 (patch) | |
| tree | 4689cb46e0d543af889609e260b1ff03455a2701 /instrumentation/compare-transform-pass.so.cc | |
| parent | 271116f8705e08d1b4f924cda6c6cae1b0b5de2b (diff) | |
| parent | b9e855b7b5ef3d7f367b32ee03459a9f5b21360f (diff) | |
| download | afl++-068bef5eab942df0a133c92522f2ab81b28ac636.tar.gz | |
Merge pull request #691 from AFLplusplus/dev
push to stable
Diffstat (limited to 'instrumentation/compare-transform-pass.so.cc')
| -rw-r--r-- | instrumentation/compare-transform-pass.so.cc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/instrumentation/compare-transform-pass.so.cc b/instrumentation/compare-transform-pass.so.cc index de8b97f0..da5cf7e9 100644 --- a/instrumentation/compare-transform-pass.so.cc +++ b/instrumentation/compare-transform-pass.so.cc @@ -68,7 +68,7 @@ class CompareTransform : public ModulePass { const char *getPassName() const override { #else - StringRef getPassName() const override { + StringRef getPassName() const override { #endif return "transforms compare functions"; @@ -101,22 +101,31 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, IntegerType * Int64Ty = IntegerType::getInt64Ty(C); #if LLVM_VERSION_MAJOR < 9 - Constant * + Function *tolowerFn; #else - FunctionCallee + FunctionCallee tolowerFn; #endif - c = M.getOrInsertFunction("tolower", Int32Ty, Int32Ty + { + +#if LLVM_VERSION_MAJOR < 9 + Constant * +#else + FunctionCallee +#endif + c = M.getOrInsertFunction("tolower", Int32Ty, Int32Ty #if LLVM_VERSION_MAJOR < 5 - , - NULL + , + NULL #endif - ); + ); #if LLVM_VERSION_MAJOR < 9 - Function *tolowerFn = cast<Function>(c); + tolowerFn = cast<Function>(c); #else - FunctionCallee tolowerFn = c; + tolowerFn = c; #endif + } + /* iterate over all functions, bbs and instruction and add suitable calls to * strcmp/memcmp/strncmp/strcasecmp/strncasecmp */ for (auto &F : M) { @@ -234,7 +243,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, if (!HasStr2) { - auto *Ptr = dyn_cast<ConstantExpr>(Str1P); + Ptr = dyn_cast<ConstantExpr>(Str1P); if (Ptr && Ptr->isGEPWithNoNotionalOverIndexing()) { if (auto *Var = dyn_cast<GlobalVariable>(Ptr->getOperand(0))) { |
