diff options
author | Marc Poulhiès <poulhies@adacore.com> | 2022-03-03 13:05:17 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-04-08 09:50:08 +0200 |
commit | 396de6fc9c49e6865b3130489ed39c7ea47540d1 (patch) | |
tree | e54e58c11b043a8a58dbafb6da868ebd0671013a | |
parent | 9933a6f3ab6c5b02c9f108dded6eb93ed59d2941 (diff) | |
download | afl++-396de6fc9c49e6865b3130489ed39c7ea47540d1.tar.gz |
Fix GCC plugin crash when using deny/allow list
The provided function declaration F may not have valid location information. Return an empty string in this case as the two callers are already using this convention to filter out functions from being instrumented when deny/allow list are used.
-rw-r--r-- | instrumentation/afl-gcc-pass.so.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/instrumentation/afl-gcc-pass.so.cc b/instrumentation/afl-gcc-pass.so.cc index 734fa170..bb5483fc 100644 --- a/instrumentation/afl-gcc-pass.so.cc +++ b/instrumentation/afl-gcc-pass.so.cc @@ -714,9 +714,11 @@ struct afl_pass : gimple_opt_pass { } + /* Returns the source file name attached to the function declaration F. If + there is no source location information, returns an empty string. */ std::string getSourceName(function *F) { - return DECL_SOURCE_FILE(F->decl); + return DECL_SOURCE_FILE(F->decl) ? DECL_SOURCE_FILE(F->decl) : ""; } |