mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-19 04:58:08 +00:00
import transform fix into autodict, code-format
This commit is contained in:
@ -279,12 +279,13 @@ library_list_t *find_library(char *name) {
|
||||
/* for having an easy breakpoint after load the shared library */
|
||||
// this seems to work for clang too. nice :) requires gcc 4.4+
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
#pragma GCC optimize("O0")
|
||||
void breakpoint() {
|
||||
|
||||
if (debug) fprintf(stderr, "Breakpoint function \"breakpoint\" reached.\n");
|
||||
|
||||
}
|
||||
|
||||
#pragma GCC pop_options
|
||||
|
||||
/* Error reporting to forkserver controller */
|
||||
@ -510,8 +511,10 @@ void setup_trap_instrumentation() {
|
||||
// Create shadow memory.
|
||||
#ifdef __aarch64__
|
||||
for (int i = 0; i < 8; i++) {
|
||||
|
||||
#else
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
#endif
|
||||
|
||||
void *shadow_addr = SHADOW(lib_addr + i);
|
||||
@ -549,7 +552,8 @@ void setup_trap_instrumentation() {
|
||||
|
||||
// Make lookup entry in shadow memory.
|
||||
|
||||
#if ((defined(__APPLE__) && defined(__LP64__)) || defined(__x86_64__) || defined(__i386__))
|
||||
#if ((defined(__APPLE__) && defined(__LP64__)) || defined(__x86_64__) || \
|
||||
defined(__i386__))
|
||||
|
||||
// this is for Intel x64
|
||||
|
||||
@ -566,7 +570,7 @@ void setup_trap_instrumentation() {
|
||||
|
||||
// this is for aarch64
|
||||
|
||||
uint32_t *patch_bytes = (uint32_t*)(lib_addr + offset);
|
||||
uint32_t *patch_bytes = (uint32_t *)(lib_addr + offset);
|
||||
uint32_t orig_bytes = *patch_bytes;
|
||||
*shadow = (bitmap_index << 32) | orig_bytes;
|
||||
*patch_bytes = 0xd4200000; // replace instruction with debug trap
|
||||
|
@ -718,7 +718,9 @@ int main(int argc, char **argv, char **envp) {
|
||||
}
|
||||
|
||||
if (instrument_opt_mode && lto_mode)
|
||||
FATAL("CTX and NGRAM can not be used in LTO mode (and would make LTO useless)");
|
||||
FATAL(
|
||||
"CTX and NGRAM can not be used in LTO mode (and would make LTO "
|
||||
"useless)");
|
||||
|
||||
if (!instrument_opt_mode) {
|
||||
|
||||
|
@ -346,6 +346,8 @@ struct InsTrimLTO : public ModulePass {
|
||||
if (auto *Var =
|
||||
dyn_cast<GlobalVariable>(Ptr->getOperand(0))) {
|
||||
|
||||
if (Var->hasInitializer()) {
|
||||
|
||||
if (auto *Array = dyn_cast<ConstantDataArray>(
|
||||
Var->getInitializer())) {
|
||||
|
||||
@ -360,6 +362,8 @@ struct InsTrimLTO : public ModulePass {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// for the internal memcpy routine we only care for the second
|
||||
// parameter and are not reporting anything.
|
||||
if (isIntMemcpy == true) {
|
||||
@ -419,6 +423,8 @@ struct InsTrimLTO : public ModulePass {
|
||||
if (auto *Var =
|
||||
dyn_cast<GlobalVariable>(Ptr->getOperand(0))) {
|
||||
|
||||
if (Var->hasInitializer()) {
|
||||
|
||||
if (auto *Array = dyn_cast<ConstantDataArray>(
|
||||
Var->getInitializer())) {
|
||||
|
||||
@ -433,6 +439,8 @@ struct InsTrimLTO : public ModulePass {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Neither a literal nor a global variable?
|
||||
// maybe it is a local variable that we saved
|
||||
if (!HasStr1) {
|
||||
|
@ -326,8 +326,10 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
||||
|
||||
if (auto *Var = dyn_cast<GlobalVariable>(Ptr->getOperand(0))) {
|
||||
|
||||
if (auto *Array =
|
||||
dyn_cast<ConstantDataArray>(Var->getInitializer())) {
|
||||
if (Var->hasInitializer()) {
|
||||
|
||||
if (auto *Array = dyn_cast<ConstantDataArray>(
|
||||
Var->getInitializer())) {
|
||||
|
||||
HasStr2 = true;
|
||||
Str2 = Array->getAsString().str();
|
||||
@ -340,6 +342,8 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// for the internal memcpy routine we only care for the second
|
||||
// parameter and are not reporting anything.
|
||||
if (isIntMemcpy == true) {
|
||||
@ -398,8 +402,10 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
||||
|
||||
if (auto *Var = dyn_cast<GlobalVariable>(Ptr->getOperand(0))) {
|
||||
|
||||
if (auto *Array =
|
||||
dyn_cast<ConstantDataArray>(Var->getInitializer())) {
|
||||
if (Var->hasInitializer()) {
|
||||
|
||||
if (auto *Array = dyn_cast<ConstantDataArray>(
|
||||
Var->getInitializer())) {
|
||||
|
||||
HasStr1 = true;
|
||||
Str1 = Array->getAsString().str();
|
||||
@ -412,6 +418,8 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Neither a literal nor a global variable?
|
||||
// maybe it is a local variable that we saved
|
||||
if (!HasStr1) {
|
||||
|
Reference in New Issue
Block a user