This commit is contained in:
Dongjia Zhang 2022-07-17 21:15:45 +02:00 committed by GitHub
parent 321bcfeba1
commit 999eaadc16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 30 deletions

View File

@ -619,6 +619,7 @@ bool AutoTokensPass::runOnModule(Module &M) {
LLVMContext &Ctx = M.getContext(); LLVMContext &Ctx = M.getContext();
if (dictionary.size()) {
size_t memlen = 0, count = 0, offset = 0; size_t memlen = 0, count = 0, offset = 0;
// sort and unique the dictionary // sort and unique the dictionary
@ -631,6 +632,7 @@ bool AutoTokensPass::runOnModule(Module &M) {
count++; count++;
} }
if (count) {
auto ptrhld = std::unique_ptr<char[]>(new char[memlen + count]); auto ptrhld = std::unique_ptr<char[]>(new char[memlen + count]);
count = 0; count = 0;
@ -650,9 +652,12 @@ bool AutoTokensPass::runOnModule(Module &M) {
// The actual dict // The actual dict
GlobalVariable *dict = new GlobalVariable( GlobalVariable *dict = new GlobalVariable(
M, arrayTy, true, GlobalVariable::ExternalLinkage, M, arrayTy, true, GlobalVariable::ExternalLinkage,
ConstantDataArray::get(Ctx, *(new ArrayRef<char>(ptrhld.get(), offset))), ConstantDataArray::get(Ctx,
*(new ArrayRef<char>(ptrhld.get(), offset))),
"libafl_dictionary_" + M.getName()); "libafl_dictionary_" + M.getName());
dict->setSection("libafl_token"); dict->setSection("libafl_token");
}
}
#if USE_NEW_PM #if USE_NEW_PM
auto PA = PreservedAnalyses::all(); auto PA = PreservedAnalyses::all();

View File

@ -11,7 +11,7 @@ cargo fmt
echo "[*] Formatting C(pp) files" echo "[*] Formatting C(pp) files"
# shellcheck disable=SC2046 # shellcheck disable=SC2046
clang-format-13 -i --style=file $(find . -type f \( -name '*.cpp' -o -iname '*.hpp' -o -name '*.cc' -o -name '*.cxx' -o -name '*.cc' -o -name '*.h' \) | grep -v '/target/' | grep -v 'libpng-1\.6\.37' | grep -v 'stb_image\.h' | grep -v 'dlmalloc\.c') clang-format -i --style=file $(find . -type f \( -name '*.cpp' -o -iname '*.hpp' -o -name '*.cc' -o -name '*.cxx' -o -name '*.cc' -o -name '*.h' \) | grep -v '/target/' | grep -v 'libpng-1\.6\.37' | grep -v 'stb_image\.h' | grep -v 'dlmalloc\.c')