[Forensics-changes] [yara] 315/415: Fix bug causing strings behaving as “nocase” without being declared as such

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:18 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 8050f97a94d809ba91698b4c15bb8167219198d7
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Wed Dec 18 18:27:31 2013 +0100

    Fix bug causing strings behaving as “nocase” without being declared as such
---
 libyara/Makefile.am |  2 +-
 libyara/lexer.c     | 44 ++++++++++++++++++++++++--------------------
 libyara/lexer.l     |  4 ++++
 3 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/libyara/Makefile.am b/libyara/Makefile.am
index dfb8af5..99b2243 100644
--- a/libyara/Makefile.am
+++ b/libyara/Makefile.am
@@ -1,6 +1,6 @@
 AM_YFLAGS=-d
 
-AM_CFLAGS=-g -O4 -Wall -std=gnu99
+AM_CFLAGS=-g -O0 -Wall -std=gnu99
 
 ACLOCAL_AMFLAGS=-I m4
 
diff --git a/libyara/lexer.c b/libyara/lexer.c
index 2776d94..cc3ed40 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -1503,6 +1503,8 @@ YY_RULE_SETUP
 
   s = (SIZED_STRING*) yr_malloc(yyextra->lex_buf_len + sizeof(SIZED_STRING));
   s->length = yyextra->lex_buf_len;
+  s->flags = 0;
+
   memcpy(s->c_string, yyextra->lex_buf, yyextra->lex_buf_len + 1);
   yylval->sized_string = s;
 
@@ -1511,7 +1513,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 358 "lexer.l"
+#line 360 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\t", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1521,7 +1523,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 366 "lexer.l"
+#line 368 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\"", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1531,7 +1533,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 374 "lexer.l"
+#line 376 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\\", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1541,7 +1543,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 382 "lexer.l"
+#line 384 "lexer.l"
 {
 
    int result;
@@ -1554,13 +1556,13 @@ YY_RULE_SETUP
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 393 "lexer.l"
+#line 395 "lexer.l"
 { YYTEXT_TO_BUFFER; }
 	YY_BREAK
 case 66:
 /* rule 66 can match eol */
 YY_RULE_SETUP
-#line 396 "lexer.l"
+#line 398 "lexer.l"
 {
 
   yyerror(yyscanner, "unterminated string");
@@ -1570,7 +1572,7 @@ YY_RULE_SETUP
 case 67:
 /* rule 67 can match eol */
 YY_RULE_SETUP
-#line 402 "lexer.l"
+#line 404 "lexer.l"
 {
 
   yyerror(yyscanner, "illegal escape sequence");
@@ -1578,7 +1580,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 408 "lexer.l"
+#line 410 "lexer.l"
 {
 
   SIZED_STRING* s;
@@ -1609,7 +1611,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 69:
 YY_RULE_SETUP
-#line 437 "lexer.l"
+#line 439 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("/", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1619,7 +1621,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 445 "lexer.l"
+#line 447 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\\.", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1630,13 +1632,13 @@ YY_RULE_SETUP
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 454 "lexer.l"
+#line 456 "lexer.l"
 { YYTEXT_TO_BUFFER; }
 	YY_BREAK
 case 72:
 /* rule 72 can match eol */
 YY_RULE_SETUP
-#line 457 "lexer.l"
+#line 459 "lexer.l"
 {
 
   yyerror(yyscanner, "unterminated regular expression");
@@ -1645,7 +1647,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 73:
 YY_RULE_SETUP
-#line 464 "lexer.l"
+#line 466 "lexer.l"
 {
 
   yyextra->lex_buf_ptr = yyextra->lex_buf;
@@ -1655,7 +1657,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 472 "lexer.l"
+#line 474 "lexer.l"
 {
 
   yyextra->lex_buf_ptr = yyextra->lex_buf;
@@ -1666,13 +1668,15 @@ YY_RULE_SETUP
 case 75:
 /* rule 75 can match eol */
 YY_RULE_SETUP
-#line 480 "lexer.l"
+#line 482 "lexer.l"
 {
 
   int len = strlen(yytext);
   SIZED_STRING* s = (SIZED_STRING*) yr_malloc(len + sizeof(SIZED_STRING));
 
   s->length = len;
+  s->flags = 0;
+
   strcpy(s->c_string, yytext);
   yylval->sized_string = s;
 
@@ -1682,12 +1686,12 @@ YY_RULE_SETUP
 case 76:
 /* rule 76 can match eol */
 YY_RULE_SETUP
-#line 493 "lexer.l"
+#line 497 "lexer.l"
 /* skip whitespace */
 	YY_BREAK
 case 77:
 YY_RULE_SETUP
-#line 495 "lexer.l"
+#line 499 "lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1703,10 +1707,10 @@ YY_RULE_SETUP
 	YY_BREAK
 case 78:
 YY_RULE_SETUP
-#line 508 "lexer.l"
+#line 512 "lexer.l"
 ECHO;
 	YY_BREAK
-#line 1710 "lexer.c"
+#line 1714 "lexer.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -2839,7 +2843,7 @@ void yara_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 508 "lexer.l"
+#line 512 "lexer.l"
 
 
 
diff --git a/libyara/lexer.l b/libyara/lexer.l
index 66d1c79..a54982e 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -348,6 +348,8 @@ $({letter}|{digit}|_)*  {
 
   s = (SIZED_STRING*) yr_malloc(yyextra->lex_buf_len + sizeof(SIZED_STRING));
   s->length = yyextra->lex_buf_len;
+  s->flags = 0;
+
   memcpy(s->c_string, yyextra->lex_buf, yyextra->lex_buf_len + 1);
   yylval->sized_string = s;
 
@@ -483,6 +485,8 @@ $({letter}|{digit}|_)*  {
   SIZED_STRING* s = (SIZED_STRING*) yr_malloc(len + sizeof(SIZED_STRING));
 
   s->length = len;
+  s->flags = 0;
+
   strcpy(s->c_string, yytext);
   yylval->sized_string = s;
 

-- 
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