[Forensics-changes] [yara] 305/407: Implement in_range(), which is inclusive.

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:28:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.3.0
in repository yara.

commit a563875c77339e50ec5e6667224550e7c44887f7
Author: Wesley Shields <wxs at atarininja.org>
Date:   Sat Jan 3 15:54:49 2015 -0500

    Implement in_range(), which is inclusive.
---
 libyara/modules/math.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libyara/modules/math.c b/libyara/modules/math.c
index db6f84b..5f158b5 100644
--- a/libyara/modules/math.c
+++ b/libyara/modules/math.c
@@ -529,9 +529,23 @@ define_function(string_monte_carlo_pi)
 }
 
 
+define_function(in_range)
+{
+  double test = double_argument(1);
+  double lower = double_argument(2);
+  double upper = double_argument(3);
+
+  if (IS_UNDEFINED(test) || IS_UNDEFINED(lower) || IS_UNDEFINED(upper))
+    return_double(UNDEFINED);
+
+  return_integer((lower <= test && test <= upper) ? 1 : 0);
+}
+
+
 begin_declarations;
 
   declare_double("MEAN_BYTES");
+  declare_function("in_range", "ddd", "i", in_range);
   declare_function("deviation", "iid", "d", data_deviation);
   declare_function("deviation", "sd", "d", string_deviation);
   declare_function("mean", "ii", "d", data_mean);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list