about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-04-18 10:44:42 +0200
committerGitHub <noreply@github.com>2022-04-18 10:44:42 +0200
commite1c4a4ea7e2e88db5899051494a71df6387a2613 (patch)
treedbc34979f6d4a8451e8b6682a5b7df72bb981a98
parentb092ee4986bb43587856e602cd35a924e3247660 (diff)
parent396de6fc9c49e6865b3130489ed39c7ea47540d1 (diff)
downloadafl++-e1c4a4ea7e2e88db5899051494a71df6387a2613.tar.gz
Merge pull request #1382 from AdaCore/pr/gcc_deny_list_fix
Fix GCC plugin crash when using deny/allow list
-rw-r--r--instrumentation/afl-gcc-pass.so.cc4
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) : "";
 
   }