Skip to content

fix(analyser): update path handling in TestFileAnalyser #2161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jiezhuzzz
Copy link

When following the example of "using fuzz-introspector w/o oss-fuzz", at the final step

# in tests/simple-example-0/work
python3 ../../../src/main.py report --target-dir=. --correlation-file=./exe_to_fuzz_introspector_logs.yaml

I got the following error:

debug info file: %s /home/cc/fuzz-introspector/tests/simple-example-0/work/../work/fuzzerLogFile-0-xvPezDK7xM.data.debug_info
debug info file: %s /home/cc/fuzz-introspector/tests/simple-example-0/work/../work/fuzzerLogFile-0-xvPezDK7xM.data.debug_all_types
debug info file: %s /home/cc/fuzz-introspector/tests/simple-example-0/work/../work/fuzzerLogFile-0-xvPezDK7xM.data.debug_all_functions
Traceback (most recent call last):
  File "/home/cc/fuzz-introspector/tests/simple-example-0/work/../../../src/main.py", line 25, in <module>
    main()
  File "/home/cc/fuzz-introspector/tests/simple-example-0/work/../../../src/main.py", line 20, in main
    cli.main()
  File "/home/cc/fuzz-introspector/src/fuzz_introspector/cli.py", line 311, in main
    return_code, _ = commands.run_analysis_on_dir(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cc/fuzz-introspector/src/fuzz_introspector/commands.py", line 167, in run_analysis_on_dir
    html_report.create_html_report(introspection_proj,
  File "/home/cc/fuzz-introspector/src/fuzz_introspector/html_report.py", line 786, in create_html_report
    html_report_core += create_section_optional_analyses(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cc/fuzz-introspector/src/fuzz_introspector/html_report.py", line 676, in create_section_optional_analyses
    html_string = analysis_instance.analysis_func(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cc/fuzz-introspector/src/fuzz_introspector/analyses/test_file_analyser.py", line 105, in analysis_func
    self.standalone_analysis(introspection_proj.proj_profile,
  File "/home/cc/fuzz-introspector/src/fuzz_introspector/analyses/test_file_analyser.py", line 125, in standalone_analysis
    common_path = os.path.commonpath(paths)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 547, in commonpath
ValueError: Can't mix absolute and relative paths

I changed the path handling logic to use the absolute path, and it works. Hope this PR can help.

Copy link
Contributor

@DavidKorczynski DavidKorczynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! The change looks good, are you able to sign DCO?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants