Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
Signed-off-by: David Korczynski <david@adalogics.com>
  • Loading branch information
DavidKorczynski committed Jan 2, 2025
1 parent c099b3d commit aeaf0e1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/fuzz_introspector/frontends/oss_fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,39 @@ def process_jvm_project(target_dir, entrypoint, out):
f.write(f'Call tree\n{calltree}')


def process_rust_project(target_dir, out):
"""Process a project in Rust based language"""
# Extract rust source files
logger.info('Going Rust route')
source_files = []
source_files = frontend_rust.capture_source_files_in_tree(target_dir)

# Process tree sitter for rust source files
logger.info('Found %d files to include in analysis', len(source_files))
logger.info('Loading tree-sitter trees')
source_codes = frontend_rust.load_treesitter_trees(source_files)

# Create and dump project
logger.info('Creating base project.')
project = frontend_rust.Project(source_codes)

# Process calltree and method data
for harness in project.get_source_codes_with_harnesses():
harness_name = harness.source_file.split('/')[-1].split('.')[0]

# Method data
logger.info(f'Dump methods for {harness_name}')
target = os.path.join(out, f'fuzzerLogFile-{harness_name}.data.yaml')
project.dump_module_logic(target, harness_name)

# Calltree
logger.info(f'Extracting calltree for {harness_name}')
calltree = project.extract_calltree(harness.source_file, harness)
target = os.path.join(out, f'fuzzerLogFile-{harness_name}.data')
with open(target, 'w', encoding='utf-8') as f:
f.write(f'Call tree\n{calltree}')


def analyse_folder(language: str = '',
directory: str = '',
entrypoint: str = '',
Expand Down

0 comments on commit aeaf0e1

Please sign in to comment.