Permalink
Browse files

Fix issue #324

  • Loading branch information...
plusvic committed Jun 30, 2015
1 parent 47b1d08 commit 2bd7c65d41944e704b8c16aa06425a859579e9d0
Showing with 11 additions and 6 deletions.
  1. +9 −6 libyara/atoms.c
  2. +2 −0 yara-python/tests.py
View
@@ -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;
}
View
@@ -258,6 +258,8 @@
('(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'),
]

0 comments on commit 2bd7c65

Please sign in to comment.