mirror of
https://github.com/VirusTotal/yara.git
synced 2026-10-11 22:49:58 +00:00
math.count returns undefined value when the passed value is outside the 0-255 range.
This commit is contained in:
+33
-1
@@ -71,6 +71,38 @@ int main(int argc, char** argv)
|
||||
}",
|
||||
"AABAAB");
|
||||
|
||||
assert_true_rule_blob(
|
||||
"import \"math\" \
|
||||
rule test { \
|
||||
condition: \
|
||||
math.count(0x41, 4, 10) == 1 \
|
||||
}",
|
||||
"AABAAB");
|
||||
|
||||
assert_true_rule_blob(
|
||||
"import \"math\" \
|
||||
rule test { \
|
||||
condition: \
|
||||
not defined math.count(0x41, 10, 3) \
|
||||
}",
|
||||
"AABAAB");
|
||||
|
||||
assert_true_rule_blob(
|
||||
"import \"math\" \
|
||||
rule test { \
|
||||
condition: \
|
||||
not defined math.count(0x41, 0, -3) \
|
||||
}",
|
||||
"AABAAB");
|
||||
|
||||
assert_true_rule_blob(
|
||||
"import \"math\" \
|
||||
rule test { \
|
||||
condition: \
|
||||
not defined math.count(-1) \
|
||||
}",
|
||||
"AABAAB");
|
||||
|
||||
assert_true_rule_blob(
|
||||
"import \"math\" \
|
||||
rule test { \
|
||||
@@ -85,7 +117,7 @@ int main(int argc, char** argv)
|
||||
condition: \
|
||||
math.percentage(0x41) > 0.39 and math.percentage(0x41) < 0.41 \
|
||||
}",
|
||||
"ABAB"); // Blob matching includes terminating zero byte
|
||||
"ABAB"); // Blob matching includes terminating zero byte
|
||||
|
||||
assert_true_rule_blob(
|
||||
"import \"math\" \
|
||||
|
||||
Reference in New Issue
Block a user