[Forensics-changes] [yara] 174/192: Fix issue #661
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:32:01 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.6.0
in repository yara.
commit 9b7f2477a8c67f41d91a1c591c2180e57bb9ddfa
Author: Victor Manuel Alvarez <vmalvarez at vmalvarez-macbookpro.roam.corp.google.com>
Date: Mon May 15 13:56:09 2017 +0200
Fix issue #661
---
libyara/compiler.c | 2 +-
libyara/grammar.c | 8 ++++----
libyara/grammar.y | 8 ++++----
libyara/include/yara/compiler.h | 2 +-
libyara/lexer.c | 8 ++++----
libyara/lexer.l | 8 ++++----
6 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/libyara/compiler.c b/libyara/compiler.c
index 4ab1c4a..b9084e0 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -57,7 +57,7 @@ YR_API int yr_compiler_create(
new_compiler->callback = NULL;
new_compiler->last_error = ERROR_SUCCESS;
new_compiler->last_error_line = 0;
- new_compiler->error_line = 0;
+ new_compiler->current_line = 0;
new_compiler->last_result = ERROR_SUCCESS;
new_compiler->file_stack_ptr = 0;
new_compiler->file_name_stack_ptr = 0;
diff --git a/libyara/grammar.c b/libyara/grammar.c
index ea52503..30733b5 100644
--- a/libyara/grammar.c
+++ b/libyara/grammar.c
@@ -1988,7 +1988,7 @@ yyreduce:
case 34:
#line 509 "grammar.y" /* yacc.c:1661 */
{
- compiler->error_line = yyget_lineno(yyscanner);
+ compiler->current_line = yyget_lineno(yyscanner);
}
#line 1994 "grammar.c" /* yacc.c:1661 */
break;
@@ -2003,7 +2003,7 @@ yyreduce:
yr_free((yyvsp[-1].sized_string));
ERROR_IF((yyval.string) == NULL);
- compiler->error_line = 0;
+ compiler->current_line = 0;
}
#line 2009 "grammar.c" /* yacc.c:1661 */
break;
@@ -2011,7 +2011,7 @@ yyreduce:
case 36:
#line 524 "grammar.y" /* yacc.c:1661 */
{
- compiler->error_line = yyget_lineno(yyscanner);
+ compiler->current_line = yyget_lineno(yyscanner);
}
#line 2017 "grammar.c" /* yacc.c:1661 */
break;
@@ -2027,7 +2027,7 @@ yyreduce:
ERROR_IF((yyval.string) == NULL);
- compiler->error_line = 0;
+ compiler->current_line = 0;
}
#line 2033 "grammar.c" /* yacc.c:1661 */
break;
diff --git a/libyara/grammar.y b/libyara/grammar.y
index e7228ca..7c83dec 100644
--- a/libyara/grammar.y
+++ b/libyara/grammar.y
@@ -507,7 +507,7 @@ string_declarations
string_declaration
: _STRING_IDENTIFIER_ '='
{
- compiler->error_line = yyget_lineno(yyscanner);
+ compiler->current_line = yyget_lineno(yyscanner);
}
_TEXT_STRING_ string_modifiers
{
@@ -518,11 +518,11 @@ string_declaration
yr_free($4);
ERROR_IF($$ == NULL);
- compiler->error_line = 0;
+ compiler->current_line = 0;
}
| _STRING_IDENTIFIER_ '='
{
- compiler->error_line = yyget_lineno(yyscanner);
+ compiler->current_line = yyget_lineno(yyscanner);
}
_REGEXP_ string_modifiers
{
@@ -534,7 +534,7 @@ string_declaration
ERROR_IF($$ == NULL);
- compiler->error_line = 0;
+ compiler->current_line = 0;
}
| _STRING_IDENTIFIER_ '=' _HEX_STRING_
{
diff --git a/libyara/include/yara/compiler.h b/libyara/include/yara/compiler.h
index 550480f..356380f 100644
--- a/libyara/include/yara/compiler.h
+++ b/libyara/include/yara/compiler.h
@@ -63,7 +63,7 @@ typedef struct _YR_FIXUP
typedef struct _YR_COMPILER
{
int errors;
- int error_line;
+ int current_line;
int last_error;
int last_error_line;
int last_result;
diff --git a/libyara/lexer.c b/libyara/lexer.c
index a60392b..9bb5ad3 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -3107,7 +3107,7 @@ void yywarning(
compiler->callback(
YARA_ERROR_LEVEL_WARNING,
file_name,
- yara_yyget_lineno(yyscanner),
+ compiler->current_line ? compiler->current_line : yara_yyget_lineno(yyscanner),
message,
compiler->user_data);
@@ -3142,12 +3142,12 @@ void yyerror(
compiler->errors++;
- if (compiler->error_line != 0)
- compiler->last_error_line = compiler->error_line;
+ if (compiler->current_line != 0)
+ compiler->last_error_line = compiler->current_line;
else
compiler->last_error_line = yara_yyget_lineno(yyscanner);
- compiler->error_line = 0;
+ compiler->current_line = 0;
if (compiler->file_name_stack_ptr > 0)
{
diff --git a/libyara/lexer.l b/libyara/lexer.l
index bb678b5..1d87a0a 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -685,7 +685,7 @@ void yywarning(
compiler->callback(
YARA_ERROR_LEVEL_WARNING,
file_name,
- yyget_lineno(yyscanner),
+ compiler->current_line ? compiler->current_line : yyget_lineno(yyscanner),
message,
compiler->user_data);
@@ -720,12 +720,12 @@ void yyerror(
compiler->errors++;
- if (compiler->error_line != 0)
- compiler->last_error_line = compiler->error_line;
+ if (compiler->current_line != 0)
+ compiler->last_error_line = compiler->current_line;
else
compiler->last_error_line = yyget_lineno(yyscanner);
- compiler->error_line = 0;
+ compiler->current_line = 0;
if (compiler->file_name_stack_ptr > 0)
{
--
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