[Forensics-changes] [yara] 09/368: Fix issue #324
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:30:05 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.5.0
in repository yara.
commit 2bd7c65d41944e704b8c16aa06425a859579e9d0
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Tue Jun 30 18:43:42 2015 +0200
Fix issue #324
---
libyara/atoms.c | 15 +++++++++------
yara-python/tests.py | 2 ++
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/libyara/atoms.c b/libyara/atoms.c
index 5ef650c..fa21036 100644
--- a/libyara/atoms.c
+++ b/libyara/atoms.c
@@ -338,7 +338,7 @@ int _yr_atoms_choose(
YR_ATOM_LIST_ITEM* tail;
int i, quality;
- int max_quality = 0;
+ int max_quality = -10000;
int min_quality = 10000;
*choosen_atoms = NULL;
@@ -401,12 +401,15 @@ int _yr_atoms_choose(
if (quality < min_quality)
min_quality = quality;
- tail = item;
- while (tail->next != NULL)
- tail = tail->next;
+ if (item != NULL)
+ {
+ tail = item;
+ while (tail->next != NULL)
+ tail = tail->next;
- tail->next = *choosen_atoms;
- *choosen_atoms = item;
+ tail->next = *choosen_atoms;
+ *choosen_atoms = item;
+ }
child = child->next_sibling;
}
diff --git a/yara-python/tests.py b/yara-python/tests.py
index 14d9e4f..ef32836 100644
--- a/yara-python/tests.py
+++ b/yara-python/tests.py
@@ -258,6 +258,8 @@ RE_TESTS = [
('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', FAIL),
('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', SUCCEED, 'effgz'),
+ # Test case for issue #324
+ ('whatever| x. x', ' xy x', SUCCEED, ' xy x'),
]
--
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