Skip to content
Merged
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
6 changes: 4 additions & 2 deletions .github/workflows/smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ jobs:

- name: Check Ahmyth Result
shell: bash
# This sample should have 39 behaviors with 100% confidence
# 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 }}" == "39" ]; then
if [ "${{ env.Ahmyth_RESULT }}" == "38" ]; then
exit 0
else
exit 1
Expand Down
4 changes: 2 additions & 2 deletions quark/evaluator/pyeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(self, apkinfo):
for second_type in ("int", "long", "float", "double"):
if first_type == second_type:
continue
self.eval[f"{first_type}-{second_type}"] = self.CAST_TYPE
self.eval[f"{first_type}-to-{second_type}"] = self.CAST_TYPE

# binop_kind
for prefix in (
Expand Down Expand Up @@ -638,7 +638,7 @@ def NEG_AND_NOT_KIND(self, instruction):
@logger
def CAST_TYPE(self, instruction):
try:
part = instruction[0].split("-")
part = instruction[0].split("-to-")
value_type = self.type_mapping[part[1]]

if part[0] in ("double", "long"):
Expand Down
26 changes: 10 additions & 16 deletions tests/evaluator/test_pyeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,19 @@ def neg_not_wide_kind(request):

ALL_CAST_KIND = list(
{
prefix + "-" + postfix
prefix + "-to-" + postfix
for prefix, postfix in itertools.product(
("int", "long", "float", "double"),
("int", "long", "float", "double"),
)
}.difference(
{
"int-int",
"long-long",
"float-float",
"double-double",
"double-long",
"long-double",
"int-to-int",
"long-to-long",
"float-to-float",
"double-to-double",
"double-to-long",
"long-to-double",
}
)
)
Expand Down Expand Up @@ -956,9 +956,7 @@ def test_neg_and_not_wide_kind(self, pyeval, neg_not_wide_kind):
# Tests for type-casting
def test_type_casting_without_wide_type(self, pyeval, cast_kind):
instruction = [cast_kind, "v1", "v5"]

index = cast_kind.index("-") + 1
postfix = cast_kind[index:]
prefix, postfix = cast_kind.split("-to-")

pyeval.eval[instruction[0]](instruction)

Expand All @@ -970,9 +968,7 @@ def test_type_casting_with_wide_type_to_simple_type(
self, pyeval, cast_wide_to_simple_kind
):
instruction = [cast_wide_to_simple_kind, "v1", "v5"]

index = cast_wide_to_simple_kind.index("-") + 1
postfix = cast_wide_to_simple_kind[index:]
prefix, postfix = cast_wide_to_simple_kind.split("-to-")

pyeval.eval[instruction[0]](instruction)

Expand All @@ -985,9 +981,7 @@ def test_type_casting_with_simple_type_to_wide_type(
self, pyeval, cast_simple_to_wide_kind
):
instruction = [cast_simple_to_wide_kind, "v1", "v5"]

index = cast_simple_to_wide_kind.index("-") + 1
postfix = cast_simple_to_wide_kind[index:]
prefix, postfix = cast_simple_to_wide_kind.split("-to-")

pyeval.eval[instruction[0]](instruction)

Expand Down
Loading