[Forensics-changes] [yara] 396/415: Fix some error handling issues
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:43:28 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch debian
in repository yara.
commit 5f281ed646b9a6f2683fe67d5816c1b5d1b36adf
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Tue Feb 11 10:23:00 2014 +0100
Fix some error handling issues
---
libyara/rules.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/libyara/rules.c b/libyara/rules.c
index 5b0a3ec..2e82160 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -651,6 +651,7 @@ int _yr_scan_verify_re_match(
RE_EXEC_FUNC exec;
int forward_matches = -1;
+ int backward_matches = -1;
int flags = 0;
if (STRING_IS_FAST_HEX_REGEXP(ac_match->string))
@@ -710,18 +711,24 @@ int _yr_scan_verify_re_match(
if (ac_match->backward_code != NULL)
{
- exec(
+ backward_matches = exec(
ac_match->backward_code,
data + offset,
offset + 1,
flags | RE_FLAGS_BACKWARDS | RE_FLAGS_EXHAUSTIVE,
_yr_scan_match_callback,
(void*) &callback_args);
+
+ if (backward_matches == -2)
+ return ERROR_INSUFICIENT_MEMORY;
+
+ if (backward_matches == -3)
+ return ERROR_INTERNAL_FATAL_ERROR;
}
else
{
- _yr_scan_match_callback(
- data + offset, 0, flags, &callback_args);
+ FAIL_ON_ERROR(_yr_scan_match_callback(
+ data + offset, 0, flags, &callback_args));
}
return ERROR_SUCCESS;
@@ -829,8 +836,8 @@ int _yr_scan_verify_literal_match(
callback_args.full_word = STRING_IS_FULL_WORD(string);
callback_args.tidx = yr_get_tidx();
- _yr_scan_match_callback(
- data + offset, 0, flags, &callback_args);
+ FAIL_ON_ERROR(_yr_scan_match_callback(
+ data + offset, 0, flags, &callback_args));
}
return ERROR_SUCCESS;
--
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