[Forensics-changes] [yara] 317/407: Handle negative array indexes correctly

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:28:40 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 af80d46becd8a8062d0efbc2b11ae4a7feaf9ecb
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Mon Jan 5 13:51:40 2015 +0100

    Handle negative array indexes correctly
---
 libyara/object.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libyara/object.c b/libyara/object.c
index 74318ea..eb30020 100644
--- a/libyara/object.c
+++ b/libyara/object.c
@@ -656,6 +656,9 @@ YR_OBJECT* yr_object_array_get_item(
 
   assert(object->type == OBJECT_TYPE_ARRAY);
 
+  if (index < 0)
+    return NULL;
+
   array = (YR_OBJECT_ARRAY*) object;
 
   if (array->items != NULL && array->items->count > index)
@@ -683,6 +686,7 @@ int yr_object_array_set_item(
   int i;
   int count;
 
+  assert(index >= 0);
   assert(object->type == OBJECT_TYPE_ARRAY);
 
   array = ((YR_OBJECT_ARRAY*) object);

-- 
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