diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml index de5ebf97..b905254d 100644 --- a/.github/workflows/smoke_test.yml +++ b/.github/workflows/smoke_test.yml @@ -100,10 +100,8 @@ jobs: - name: Check Ahmyth Result shell: bash # This sample should have 39 behaviors with 100% confidence. - # Rule 00015 is currently detected with 80% confidence because PyEval fails - # to track byte arrays (issue #889: https://github.com/ev-flow/quark-engine/issues/889). run: | - if [ "${{ env.Ahmyth_RESULT }}" == "38" ]; then + if [ "${{ env.Ahmyth_RESULT }}" == "39" ]; then exit 0 else exit 1 diff --git a/quark/core/struct/registerobject.py b/quark/core/struct/registerobject.py index f979ddb6..280eb506 100644 --- a/quark/core/struct/registerobject.py +++ b/quark/core/struct/registerobject.py @@ -119,7 +119,7 @@ def bears_object(self) -> bool: False otherwise. :rtype: bool """ - return self.current_type is None or self.current_type.startswith("L") + return self.current_type is None or self.current_type.startswith(("L", "[")) def iterateInvolvedCalls(self) -> Generator[MethodCall, None, None]: """ diff --git a/quark/evaluator/pyeval.py b/quark/evaluator/pyeval.py index 8bc7aa5d..462b386d 100644 --- a/quark/evaluator/pyeval.py +++ b/quark/evaluator/pyeval.py @@ -668,7 +668,7 @@ def CAST_TYPE(self, instruction): "casting({src0})", value_type=value_type, ) - except IndexError as e: + except (IndexError, KeyError) as e: log.exception(f"{e} in {instruction[0]}") @logger diff --git a/quark/utils/tools.py b/quark/utils/tools.py index 81d8cd34..0cb1a93f 100644 --- a/quark/utils/tools.py +++ b/quark/utils/tools.py @@ -21,12 +21,14 @@ def contains(subset_to_check: List[MethodObject], target_list: List[MethodObject Objects of class MethodObject are equal, if class_name, name and descriptor are equal. ----------------------------------------------------------------- - subset_to_check = ["getCellLocation", "sendTextMessage"] - target_list = ["put", "getCellLocation", "query", "sendTextMessage"] - then it will return true. + subset_to_check = [MethodObject("getCellLocation"), MethodObject("sendTextMessage")] + target_list = [MethodObject("put"), MethodObject("getCellLocation"), + MethodObject("query"), MethodObject("sendTextMessage")] + then it will return True. ----------------------------------------------------------------- - subset_to_check = ["getCellLocation", "sendTextMessage"] - target_list = ["sendTextMessage", "put", "getCellLocation", "query"] + subset_to_check = [MethodObject("getCellLocation"), MethodObject("sendTextMessage")] + target_list = [MethodObject("sendTextMessage"), MethodObject("put"), + MethodObject("getCellLocation"), MethodObject("query")] then it will return False. """ diff --git a/tests/core/struct/test_registerobject.py b/tests/core/struct/test_registerobject.py index 2bd33a75..dffafcbd 100644 --- a/tests/core/struct/test_registerobject.py +++ b/tests/core/struct/test_registerobject.py @@ -43,10 +43,12 @@ def test_value(self, standard_register_obj): def test_bears_object(self): reg_with_object = RegisterObject("value", value_type="Ljava/lang/String;") reg_with_primitive = RegisterObject("value", value_type="I") + reg_with_array = RegisterObject("value", value_type="[B") reg_with_none = RegisterObject("value", value_type=None) assert reg_with_object.bears_object() is True assert reg_with_primitive.bears_object() is False + assert reg_with_array.bears_object() is True assert reg_with_none.bears_object() is True def test_iterate_involved_calls_returns_nested_calls(self):