Skip to content

Commit

Permalink
JVM: Add static information for methods
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
  • Loading branch information
arthurscchan committed Jul 2, 2024
1 parent 7c075d4 commit bb4b795
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/fuzz_introspector/datatypes/function_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__(self, elem: Dict[Any, Any]) -> None:
self.is_accessible = self._is_function_acccessible(elem)
self.is_jvm_library = self._is_jvm_library(elem)
self.is_enum = self._is_enum_class(elem)
self.is_static = self._is_static(elem)
self.exceptions = self._get_exceptions(elem)

# Temporary handle for unreadable library method (JVM)
Expand Down Expand Up @@ -147,6 +148,12 @@ def _is_enum_class(self, elem: Dict[Any, Any]) -> bool:

return False

def _is_static(self, elem: Dict[Any, Any]) -> bool:
if "JavaMethodInfo" in elem and elem['JavaMethodInfo']:
return bool(elem['JavaMethodInfo']['static'])

return False

def _get_exceptions(self, elem: Dict[Any, Any]) -> List[str]:
if "JavaMethodInfo" in elem and elem['JavaMethodInfo']:
return elem['JavaMethodInfo']['exceptions']
Expand Down
2 changes: 2 additions & 0 deletions src/fuzz_introspector/html_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def create_all_function_table(
json_copy['is_accessible'] = fd.is_accessible
json_copy['is_jvm_library'] = fd.is_jvm_library
json_copy['is_enum_class'] = fd.is_enum
json_copy['is_static'] = fd.is_static
json_copy['exceptions'] = fd.exceptions
table_rows_json_report.append(json_copy)

Expand Down Expand Up @@ -802,6 +803,7 @@ def create_html_report(introspection_proj: analysis.IntrospectionProject,
json_copy['is_accessible'] = fd.is_accessible
json_copy['is_jvm_library'] = fd.is_jvm_library
json_copy['is_enum_class'] = fd.is_enum
json_copy['is_static'] = fd.is_static
json_copy['exceptions'] = fd.exceptions
json_copy['Fuzzers runtime hit'] = 'no'
json_copy['Func lines hit %'] = '0.0%'
Expand Down

0 comments on commit bb4b795

Please sign in to comment.