[Forensics-changes] [yara] 403/415: Fix issue #121
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 7e3f88b1032558dd1a4072759bf5d1fe67de9c2b
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Mon Feb 24 10:17:18 2014 +0100
Fix issue #121
---
libyara/parser.c | 14 +++++++++++++-
libyara/parser.h | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/libyara/parser.c b/libyara/parser.c
index 4728ae8..8fb635a 100644
--- a/libyara/parser.c
+++ b/libyara/parser.c
@@ -100,15 +100,18 @@ int yr_parser_emit_with_arg_reloc(
}
-void yr_parser_emit_pushes_for_strings(
+int yr_parser_emit_pushes_for_strings(
yyscan_t yyscanner,
const char* identifier)
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
YR_STRING* string = compiler->current_rule_strings;
+
const char* string_identifier;
const char* target_identifier;
+ int matching = 0;
+
while(!STRING_IS_NULL(string))
{
// Don't generate pushes for strings chained to another one, we are
@@ -137,6 +140,7 @@ void yr_parser_emit_pushes_for_strings(
NULL);
string->g_flags |= STRING_GFLAGS_REFERENCED;
+ matching++;
}
}
@@ -145,6 +149,14 @@ void yr_parser_emit_pushes_for_strings(
string,
sizeof(YR_STRING));
}
+
+ if (matching == 0)
+ {
+ yr_compiler_set_error_extra_info(compiler, identifier);
+ compiler->last_result = ERROR_UNDEFINED_STRING;
+ }
+
+ return compiler->last_result;
}
diff --git a/libyara/parser.h b/libyara/parser.h
index d899e2f..208d390 100644
--- a/libyara/parser.h
+++ b/libyara/parser.h
@@ -88,7 +88,7 @@ int yr_parser_reduce_string_identifier(
int8_t instruction);
-void yr_parser_emit_pushes_for_strings(
+int yr_parser_emit_pushes_for_strings(
yyscan_t yyscanner,
const char* identifier);
--
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