Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion quark/core/struct/registerobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
"""
Expand Down
2 changes: 1 addition & 1 deletion quark/evaluator/pyeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions quark/utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
2 changes: 2 additions & 0 deletions tests/core/struct/test_registerobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading