From 8e5c324afcf3f87d178af496380fe40a90300964 Mon Sep 17 00:00:00 2001 From: Arthur Chan Date: Tue, 21 Jan 2025 12:37:31 +0000 Subject: [PATCH] Analyser: Fix unexpected exit from coverage extraction Signed-off-by: Arthur Chan --- src/fuzz_introspector/analysis.py | 3 ++- src/fuzz_introspector/commands.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/fuzz_introspector/analysis.py b/src/fuzz_introspector/analysis.py index 54f627878..ca9fc4bbd 100644 --- a/src/fuzz_introspector/analysis.py +++ b/src/fuzz_introspector/analysis.py @@ -295,8 +295,9 @@ def get_node_coverage_hitcount(demangled_name: str, callstack: Dict[int, str], # The difference is this node has node "parent" or prior nodes. if not profile.func_is_entrypoint(demangled_name): - raise AnalysisError( + logger.warning( "First node in calltree is non-fuzzer function") + return 0 if profile.coverage.get_type() == 'kernel': # For now, assume EP is hit. TODO(David) adjust this. return 100 diff --git a/src/fuzz_introspector/commands.py b/src/fuzz_introspector/commands.py index db0dc5ee8..7453006da 100644 --- a/src/fuzz_introspector/commands.py +++ b/src/fuzz_introspector/commands.py @@ -196,8 +196,13 @@ def analyse(args) -> int: entrypoint=entrypoint, out=out_dir) + if 'c' in args.language: + language = 'c-cpp' + else: + language = args.language + # Perform the FI backend project analysis from the frontend - introspection_proj = analysis.IntrospectionProject(args.language, out_dir, + introspection_proj = analysis.IntrospectionProject(language, out_dir, '') introspection_proj.load_data_files(True, '', out_dir)