[Forensics-changes] [yara] 397/415: Fix issue #113
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 e139a9d0358bbc831d5ca1e8015b98010305c80a
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Tue Feb 11 13:55:22 2014 +0100
Fix issue #113
---
libyara/grammar.c | 137 ++++++++++-----------
libyara/grammar.y | 3 +
libyara/lexer.c | 341 +++++++++++++++++++++++++++--------------------------
libyara/lexer.l | 10 +-
libyara/parser.c | 3 +
libyara/rules.c | 3 +-
libyara/sizedstr.h | 3 +-
libyara/yara.h | 4 +
8 files changed, 261 insertions(+), 243 deletions(-)
diff --git a/libyara/grammar.c b/libyara/grammar.c
index fbac5ea..ec6009c 100644
--- a/libyara/grammar.c
+++ b/libyara/grammar.c
@@ -623,14 +623,14 @@ static const yytype_uint16 yyrline[] =
222, 250, 254, 255, 259, 260, 264, 265, 280, 290,
324, 325, 329, 345, 358, 371, 387, 388, 392, 406,
405, 423, 439, 440, 444, 445, 446, 447, 451, 452,
- 456, 460, 490, 528, 532, 543, 554, 558, 569, 575,
- 612, 574, 711, 710, 779, 783, 786, 790, 794, 798,
- 802, 806, 810, 814, 818, 822, 829, 848, 862, 863,
- 867, 871, 872, 876, 875, 880, 887, 888, 891, 896,
- 903, 904, 908, 915, 916, 920, 924, 928, 932, 936,
- 940, 944, 948, 952, 963, 974, 988, 1015, 1019, 1023,
- 1027, 1031, 1035, 1039, 1043, 1047, 1051, 1055, 1061, 1062,
- 1063
+ 456, 460, 490, 531, 535, 546, 557, 561, 572, 578,
+ 615, 577, 714, 713, 782, 786, 789, 793, 797, 801,
+ 805, 809, 813, 817, 821, 825, 832, 851, 865, 866,
+ 870, 874, 875, 879, 878, 883, 890, 891, 894, 899,
+ 906, 907, 911, 918, 919, 923, 927, 931, 935, 939,
+ 943, 947, 951, 955, 966, 977, 991, 1018, 1022, 1026,
+ 1030, 1034, 1038, 1042, 1046, 1050, 1054, 1058, 1064, 1065,
+ 1066
};
#endif
@@ -2183,6 +2183,9 @@ yyreduce:
if (sized_string->flags & SIZED_STRING_FLAGS_NO_CASE)
re->flags |= RE_FLAGS_NO_CASE;
+ if (sized_string->flags & SIZED_STRING_FLAGS_DOT_ALL)
+ re->flags |= RE_FLAGS_DOT_ALL;
+
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
compiler->last_result = yr_re_emit_code(
@@ -2212,14 +2215,14 @@ yyreduce:
break;
case 43:
-#line 529 "grammar.y"
+#line 532 "grammar.y"
{
yr_parser_emit(yyscanner, CONTAINS, NULL);
}
break;
case 44:
-#line 533 "grammar.y"
+#line 536 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2233,7 +2236,7 @@ yyreduce:
break;
case 45:
-#line 544 "grammar.y"
+#line 547 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2247,14 +2250,14 @@ yyreduce:
break;
case 46:
-#line 555 "grammar.y"
+#line 558 "grammar.y"
{
yr_free((yyvsp[(1) - (4)].c_string));
}
break;
case 47:
-#line 559 "grammar.y"
+#line 562 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2268,7 +2271,7 @@ yyreduce:
break;
case 48:
-#line 570 "grammar.y"
+#line 573 "grammar.y"
{
yr_free((yyvsp[(1) - (6)].c_string));
yr_free((yyvsp[(5) - (6)].sized_string));
@@ -2276,7 +2279,7 @@ yyreduce:
break;
case 49:
-#line 575 "grammar.y"
+#line 578 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int result = ERROR_SUCCESS;
@@ -2316,7 +2319,7 @@ yyreduce:
break;
case 50:
-#line 612 "grammar.y"
+#line 615 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth;
@@ -2353,7 +2356,7 @@ yyreduce:
break;
case 51:
-#line 646 "grammar.y"
+#line 649 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int mem_offset;
@@ -2421,7 +2424,7 @@ yyreduce:
break;
case 52:
-#line 711 "grammar.y"
+#line 714 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth;
@@ -2449,7 +2452,7 @@ yyreduce:
break;
case 53:
-#line 736 "grammar.y"
+#line 739 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int mem_offset;
@@ -2496,90 +2499,90 @@ yyreduce:
break;
case 54:
-#line 780 "grammar.y"
+#line 783 "grammar.y"
{
yr_parser_emit(yyscanner, OF, NULL);
}
break;
case 55:
-#line 784 "grammar.y"
+#line 787 "grammar.y"
{
}
break;
case 56:
-#line 787 "grammar.y"
+#line 790 "grammar.y"
{
yr_parser_emit(yyscanner, NOT, NULL);
}
break;
case 57:
-#line 791 "grammar.y"
+#line 794 "grammar.y"
{
yr_parser_emit(yyscanner, AND, NULL);
}
break;
case 58:
-#line 795 "grammar.y"
+#line 798 "grammar.y"
{
yr_parser_emit(yyscanner, OR, NULL);
}
break;
case 59:
-#line 799 "grammar.y"
+#line 802 "grammar.y"
{
yr_parser_emit(yyscanner, LT, NULL);
}
break;
case 60:
-#line 803 "grammar.y"
+#line 806 "grammar.y"
{
yr_parser_emit(yyscanner, GT, NULL);
}
break;
case 61:
-#line 807 "grammar.y"
+#line 810 "grammar.y"
{
yr_parser_emit(yyscanner, LE, NULL);
}
break;
case 62:
-#line 811 "grammar.y"
+#line 814 "grammar.y"
{
yr_parser_emit(yyscanner, GE, NULL);
}
break;
case 63:
-#line 815 "grammar.y"
+#line 818 "grammar.y"
{
yr_parser_emit(yyscanner, EQ, NULL);
}
break;
case 64:
-#line 819 "grammar.y"
+#line 822 "grammar.y"
{
yr_parser_emit(yyscanner, EQ, NULL);
}
break;
case 65:
-#line 823 "grammar.y"
+#line 826 "grammar.y"
{
yr_parser_emit(yyscanner, NEQ, NULL);
}
break;
case 66:
-#line 830 "grammar.y"
+#line 833 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
SIZED_STRING* sized_string = (yyvsp[(1) - (1)].sized_string);
@@ -2601,7 +2604,7 @@ yyreduce:
break;
case 67:
-#line 849 "grammar.y"
+#line 852 "grammar.y"
{
int result = yr_parser_reduce_external(
yyscanner,
@@ -2615,24 +2618,24 @@ yyreduce:
break;
case 68:
-#line 862 "grammar.y"
+#line 865 "grammar.y"
{ (yyval.integer) = INTEGER_SET_ENUMERATION; }
break;
case 69:
-#line 863 "grammar.y"
+#line 866 "grammar.y"
{ (yyval.integer) = INTEGER_SET_RANGE; }
break;
case 73:
-#line 876 "grammar.y"
+#line 879 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, UNDEFINED, NULL);
}
break;
case 75:
-#line 881 "grammar.y"
+#line 884 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, UNDEFINED, NULL);
yr_parser_emit_pushes_for_strings(yyscanner, "$*");
@@ -2640,7 +2643,7 @@ yyreduce:
break;
case 78:
-#line 892 "grammar.y"
+#line 895 "grammar.y"
{
yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[(1) - (1)].c_string));
yr_free((yyvsp[(1) - (1)].c_string));
@@ -2648,7 +2651,7 @@ yyreduce:
break;
case 79:
-#line 897 "grammar.y"
+#line 900 "grammar.y"
{
yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[(1) - (1)].c_string));
yr_free((yyvsp[(1) - (1)].c_string));
@@ -2656,84 +2659,84 @@ yyreduce:
break;
case 81:
-#line 905 "grammar.y"
+#line 908 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, UNDEFINED, NULL);
}
break;
case 82:
-#line 909 "grammar.y"
+#line 912 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, 1, NULL);
}
break;
case 84:
-#line 917 "grammar.y"
+#line 920 "grammar.y"
{
yr_parser_emit(yyscanner, SIZE, NULL);
}
break;
case 85:
-#line 921 "grammar.y"
+#line 924 "grammar.y"
{
yr_parser_emit(yyscanner, ENTRYPOINT, NULL);
}
break;
case 86:
-#line 925 "grammar.y"
+#line 928 "grammar.y"
{
yr_parser_emit(yyscanner, INT8, NULL);
}
break;
case 87:
-#line 929 "grammar.y"
+#line 932 "grammar.y"
{
yr_parser_emit(yyscanner, INT16, NULL);
}
break;
case 88:
-#line 933 "grammar.y"
+#line 936 "grammar.y"
{
yr_parser_emit(yyscanner, INT32, NULL);
}
break;
case 89:
-#line 937 "grammar.y"
+#line 940 "grammar.y"
{
yr_parser_emit(yyscanner, UINT8, NULL);
}
break;
case 90:
-#line 941 "grammar.y"
+#line 944 "grammar.y"
{
yr_parser_emit(yyscanner, UINT16, NULL);
}
break;
case 91:
-#line 945 "grammar.y"
+#line 948 "grammar.y"
{
yr_parser_emit(yyscanner, UINT32, NULL);
}
break;
case 92:
-#line 949 "grammar.y"
+#line 952 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, (yyvsp[(1) - (1)].integer), NULL);
}
break;
case 93:
-#line 953 "grammar.y"
+#line 956 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2747,7 +2750,7 @@ yyreduce:
break;
case 94:
-#line 964 "grammar.y"
+#line 967 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2761,7 +2764,7 @@ yyreduce:
break;
case 95:
-#line 975 "grammar.y"
+#line 978 "grammar.y"
{
int result = yr_parser_emit_with_arg(yyscanner, PUSH, 1, NULL);
@@ -2778,7 +2781,7 @@ yyreduce:
break;
case 96:
-#line 989 "grammar.y"
+#line 992 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int var_index;
@@ -2808,77 +2811,77 @@ yyreduce:
break;
case 97:
-#line 1016 "grammar.y"
+#line 1019 "grammar.y"
{
yr_parser_emit(yyscanner, ADD, NULL);
}
break;
case 98:
-#line 1020 "grammar.y"
+#line 1023 "grammar.y"
{
yr_parser_emit(yyscanner, SUB, NULL);
}
break;
case 99:
-#line 1024 "grammar.y"
+#line 1027 "grammar.y"
{
yr_parser_emit(yyscanner, MUL, NULL);
}
break;
case 100:
-#line 1028 "grammar.y"
+#line 1031 "grammar.y"
{
yr_parser_emit(yyscanner, DIV, NULL);
}
break;
case 101:
-#line 1032 "grammar.y"
+#line 1035 "grammar.y"
{
yr_parser_emit(yyscanner, MOD, NULL);
}
break;
case 102:
-#line 1036 "grammar.y"
+#line 1039 "grammar.y"
{
yr_parser_emit(yyscanner, XOR, NULL);
}
break;
case 103:
-#line 1040 "grammar.y"
+#line 1043 "grammar.y"
{
yr_parser_emit(yyscanner, AND, NULL);
}
break;
case 104:
-#line 1044 "grammar.y"
+#line 1047 "grammar.y"
{
yr_parser_emit(yyscanner, OR, NULL);
}
break;
case 105:
-#line 1048 "grammar.y"
+#line 1051 "grammar.y"
{
yr_parser_emit(yyscanner, NEG, NULL);
}
break;
case 106:
-#line 1052 "grammar.y"
+#line 1055 "grammar.y"
{
yr_parser_emit(yyscanner, SHL, NULL);
}
break;
case 107:
-#line 1056 "grammar.y"
+#line 1059 "grammar.y"
{
yr_parser_emit(yyscanner, SHR, NULL);
}
@@ -2886,7 +2889,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 2890 "grammar.c"
+#line 2893 "grammar.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -3100,7 +3103,7 @@ yyreturn:
}
-#line 1066 "grammar.y"
+#line 1069 "grammar.y"
diff --git a/libyara/grammar.y b/libyara/grammar.y
index 724e5a8..867ff6b 100644
--- a/libyara/grammar.y
+++ b/libyara/grammar.y
@@ -499,6 +499,9 @@ boolean_expression : '(' boolean_expression ')'
if (sized_string->flags & SIZED_STRING_FLAGS_NO_CASE)
re->flags |= RE_FLAGS_NO_CASE;
+ if (sized_string->flags & SIZED_STRING_FLAGS_DOT_ALL)
+ re->flags |= RE_FLAGS_DOT_ALL;
+
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
compiler->last_result = yr_re_emit_code(
diff --git a/libyara/lexer.c b/libyara/lexer.c
index 68f6588..1d7c1b7 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -47,7 +47,6 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
-typedef uint64_t flex_uint64_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
@@ -358,7 +357,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*/
#define YY_DO_BEFORE_ACTION \
yyg->yytext_ptr = yy_bp; \
- yyleng = (yy_size_t) (yy_cp - yy_bp); \
+ yyleng = (size_t) (yy_cp - yy_bp); \
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
@@ -372,7 +371,7 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[227] =
+static yyconst flex_int16_t yy_accept[228] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
79, 77, 76, 76, 77, 73, 55, 54, 74, 58,
@@ -385,20 +384,20 @@ static yyconst flex_int16_t yy_accept[227] =
57, 57, 25, 57, 57, 57, 26, 23, 57, 57,
57, 57, 57, 57, 57, 57, 57, 0, 65, 67,
- 62, 63, 61, 67, 71, 68, 70, 69, 51, 47,
- 49, 58, 59, 29, 22, 30, 57, 57, 57, 57,
- 57, 28, 57, 57, 57, 57, 57, 57, 57, 57,
- 21, 57, 57, 57, 33, 57, 57, 57, 57, 57,
- 57, 75, 0, 57, 57, 57, 57, 57, 35, 57,
- 57, 57, 57, 57, 57, 40, 57, 12, 57, 57,
- 57, 11, 57, 57, 27, 19, 57, 15, 64, 14,
- 57, 57, 57, 20, 57, 57, 57, 57, 45, 41,
- 42, 57, 57, 57, 57, 57, 57, 57, 57, 37,
- 57, 57, 57, 57, 57, 10, 57, 57, 17, 34,
-
- 57, 57, 57, 38, 39, 57, 57, 57, 57, 57,
- 57, 43, 9, 36, 13, 57, 44, 57, 32, 16,
- 0, 18, 57, 50, 31, 0
+ 62, 63, 61, 67, 71, 68, 68, 70, 69, 51,
+ 47, 49, 58, 59, 29, 22, 30, 57, 57, 57,
+ 57, 57, 28, 57, 57, 57, 57, 57, 57, 57,
+ 57, 21, 57, 57, 57, 33, 57, 57, 57, 57,
+ 57, 57, 75, 0, 57, 57, 57, 57, 57, 35,
+ 57, 57, 57, 57, 57, 57, 40, 57, 12, 57,
+ 57, 57, 11, 57, 57, 27, 19, 57, 15, 64,
+ 14, 57, 57, 57, 20, 57, 57, 57, 57, 45,
+ 41, 42, 57, 57, 57, 57, 57, 57, 57, 57,
+ 37, 57, 57, 57, 57, 57, 10, 57, 57, 17,
+
+ 34, 57, 57, 57, 38, 39, 57, 57, 57, 57,
+ 57, 57, 43, 9, 36, 13, 57, 44, 57, 32,
+ 16, 0, 18, 57, 50, 31, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -443,69 +442,69 @@ static yyconst flex_int32_t yy_meta[55] =
9, 9, 1, 1
} ;
-static yyconst flex_int16_t yy_base[246] =
+static yyconst flex_int16_t yy_base[247] =
{ 0,
- 0, 0, 52, 53, 54, 57, 357, 356, 351, 350,
- 359, 364, 364, 364, 338, 364, 0, 347, 51, 37,
- 40, 50, 336, 51, 0, 0, 38, 313, 313, 56,
- 314, 311, 44, 309, 53, 306, 28, 55, 55, 311,
- 310, 0, 0, 364, 364, 67, 0, 364, 309, 335,
- 0, 364, 364, 334, 364, 0, 364, 334, 364, 0,
- 0, 319, 318, 0, 364, 364, 364, 364, 364, 0,
- 0, 302, 58, 308, 0, 298, 292, 298, 297, 291,
- 295, 291, 72, 286, 285, 61, 295, 0, 291, 289,
- 297, 294, 281, 290, 276, 281, 288, 266, 0, 364,
-
- 364, 364, 364, 0, 0, 364, 364, 364, 0, 364,
- 0, 364, 0, 0, 0, 0, 281, 69, 274, 272,
- 282, 0, 276, 283, 274, 278, 93, 279, 280, 279,
- 0, 263, 259, 272, 0, 259, 266, 263, 268, 255,
- 266, 364, 0, 261, 260, 267, 245, 261, 249, 244,
- 262, 244, 240, 272, 274, 0, 250, 0, 241, 251,
- 254, 0, 245, 241, 0, 0, 101, 0, 364, 0,
- 235, 242, 236, 0, 240, 235, 237, 242, 0, 0,
- 0, 240, 239, 226, 225, 228, 233, 251, 253, 0,
- 228, 224, 222, 211, 204, 0, 204, 181, 0, 0,
-
- 185, 175, 151, 0, 0, 153, 145, 151, 154, 143,
- 173, 0, 0, 0, 0, 128, 0, 71, 0, 0,
- 94, 0, 64, 364, 0, 364, 119, 130, 141, 152,
- 157, 163, 167, 171, 175, 184, 192, 202, 213, 223,
- 234, 245, 250, 252, 254
+ 0, 0, 52, 53, 54, 57, 359, 358, 353, 352,
+ 361, 366, 366, 366, 340, 366, 0, 349, 51, 37,
+ 40, 50, 338, 51, 0, 0, 38, 315, 315, 56,
+ 316, 313, 44, 311, 53, 308, 28, 55, 55, 313,
+ 312, 0, 0, 366, 366, 67, 0, 366, 55, 338,
+ 0, 366, 366, 337, 366, 0, 366, 337, 366, 0,
+ 0, 322, 321, 0, 366, 366, 366, 366, 366, 0,
+ 0, 305, 58, 311, 0, 301, 295, 301, 300, 294,
+ 298, 294, 72, 289, 288, 64, 298, 0, 294, 292,
+ 300, 297, 284, 293, 279, 284, 291, 269, 0, 366,
+
+ 366, 366, 366, 0, 0, 277, 366, 366, 366, 0,
+ 366, 0, 366, 0, 0, 0, 0, 283, 69, 276,
+ 274, 284, 0, 278, 285, 276, 280, 93, 281, 282,
+ 281, 0, 265, 261, 274, 0, 261, 268, 265, 270,
+ 257, 268, 366, 0, 263, 262, 269, 247, 263, 251,
+ 246, 264, 246, 242, 274, 276, 0, 252, 0, 243,
+ 253, 256, 0, 247, 243, 0, 0, 101, 0, 366,
+ 0, 237, 244, 238, 0, 242, 237, 239, 244, 0,
+ 0, 0, 242, 241, 228, 227, 230, 235, 253, 255,
+ 0, 230, 212, 201, 179, 180, 0, 187, 156, 0,
+
+ 0, 166, 154, 149, 0, 0, 151, 136, 142, 140,
+ 90, 120, 0, 0, 0, 0, 80, 0, 71, 0,
+ 0, 118, 0, 61, 366, 0, 366, 124, 135, 146,
+ 157, 162, 168, 172, 176, 180, 189, 197, 207, 218,
+ 228, 239, 250, 255, 257, 259
} ;
-static yyconst flex_int16_t yy_def[246] =
+static yyconst flex_int16_t yy_def[247] =
{ 0,
- 226, 1, 227, 227, 228, 228, 229, 229, 230, 230,
- 226, 226, 226, 226, 226, 226, 231, 232, 226, 233,
- 233, 226, 226, 226, 234, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 236, 237, 226, 226, 238, 239, 226, 226, 240,
- 241, 226, 226, 226, 226, 231, 226, 232, 226, 242,
- 21, 226, 226, 243, 226, 226, 226, 226, 226, 234,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 236, 237, 226,
-
- 226, 226, 226, 244, 239, 226, 226, 226, 241, 226,
- 242, 226, 243, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 226, 245, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 226, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
-
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 226, 235, 235, 226, 235, 0, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226
+ 227, 1, 228, 228, 229, 229, 230, 230, 231, 231,
+ 227, 227, 227, 227, 227, 227, 232, 233, 227, 234,
+ 234, 227, 227, 227, 235, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 237, 238, 227, 227, 239, 240, 227, 227, 241,
+ 242, 227, 227, 227, 227, 232, 227, 233, 227, 243,
+ 21, 227, 227, 244, 227, 227, 227, 227, 227, 235,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 237, 238, 227,
+
+ 227, 227, 227, 245, 240, 227, 227, 227, 227, 242,
+ 227, 243, 227, 244, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 227, 246, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 227,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 227, 236, 236, 227, 236, 0, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227
} ;
-static yyconst flex_int16_t yy_nxt[419] =
+static yyconst flex_int16_t yy_nxt[421] =
{ 0,
12, 13, 14, 13, 15, 16, 17, 18, 12, 12,
19, 20, 21, 21, 21, 21, 21, 21, 22, 23,
@@ -515,47 +514,47 @@ static yyconst flex_int16_t yy_nxt[419] =
26, 26, 42, 12, 44, 44, 48, 45, 45, 48,
59, 60, 62, 63, 49, 62, 63, 49, 65, 66,
68, 69, 101, 84, 90, 91, 72, 85, 73, 46,
- 46, 50, 74, 75, 50, 78, 64, 87, 92, 226,
- 115, 94, 130, 79, 102, 221, 88, 80, 95, 224,
-
- 93, 145, 81, 125, 126, 154, 131, 155, 116, 225,
- 156, 223, 103, 188, 146, 189, 104, 127, 190, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 51, 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 51, 53, 53, 53, 53, 53, 53, 53, 53,
- 53, 53, 53, 56, 56, 56, 56, 58, 222, 58,
- 58, 58, 58, 61, 221, 220, 61, 70, 70, 70,
- 70, 71, 71, 71, 71, 98, 98, 219, 218, 217,
- 98, 98, 99, 99, 216, 215, 99, 99, 99, 99,
-
- 99, 99, 100, 100, 100, 100, 100, 100, 100, 100,
- 100, 100, 100, 105, 105, 214, 105, 105, 213, 105,
- 105, 105, 105, 107, 107, 212, 107, 107, 107, 107,
- 107, 107, 107, 107, 109, 109, 109, 211, 109, 109,
- 109, 109, 109, 109, 109, 111, 111, 210, 111, 111,
- 111, 111, 111, 111, 111, 111, 113, 113, 143, 143,
- 169, 169, 209, 208, 207, 206, 205, 204, 203, 202,
- 201, 200, 199, 198, 197, 196, 195, 194, 193, 192,
- 191, 187, 186, 185, 184, 183, 182, 181, 180, 179,
- 178, 177, 176, 175, 174, 173, 172, 171, 170, 168,
-
- 167, 166, 165, 164, 163, 162, 161, 160, 159, 158,
- 157, 153, 152, 151, 150, 149, 148, 147, 144, 142,
- 141, 140, 139, 138, 137, 136, 135, 134, 133, 132,
- 129, 128, 124, 123, 122, 121, 120, 119, 118, 117,
- 114, 112, 112, 57, 110, 108, 106, 97, 96, 89,
- 86, 83, 82, 77, 76, 67, 57, 55, 226, 54,
- 54, 52, 52, 11, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
-
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226
+ 46, 50, 74, 75, 50, 78, 64, 87, 92, 227,
+ 116, 94, 106, 79, 102, 131, 88, 80, 95, 107,
+
+ 93, 146, 81, 126, 127, 155, 226, 156, 117, 132,
+ 157, 224, 103, 189, 147, 190, 104, 128, 191, 222,
+ 223, 222, 221, 225, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 47, 47, 47, 47, 47,
+ 47, 47, 47, 47, 47, 47, 51, 51, 51, 51,
+ 51, 51, 51, 51, 51, 51, 51, 53, 53, 53,
+ 53, 53, 53, 53, 53, 53, 53, 53, 56, 56,
+ 56, 56, 58, 220, 58, 58, 58, 58, 61, 219,
+ 218, 61, 70, 70, 70, 70, 71, 71, 71, 71,
+ 98, 98, 217, 216, 215, 98, 98, 99, 99, 214,
+
+ 213, 99, 99, 99, 99, 99, 99, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 105, 105,
+ 212, 105, 105, 211, 105, 105, 105, 105, 108, 108,
+ 210, 108, 108, 108, 108, 108, 108, 108, 108, 110,
+ 110, 110, 209, 110, 110, 110, 110, 110, 110, 110,
+ 112, 112, 208, 112, 112, 112, 112, 112, 112, 112,
+ 112, 114, 114, 144, 144, 170, 170, 207, 206, 205,
+ 204, 203, 202, 201, 200, 199, 198, 197, 196, 195,
+ 194, 193, 192, 188, 187, 186, 185, 184, 183, 182,
+ 181, 180, 179, 178, 177, 176, 175, 174, 173, 172,
+
+ 171, 169, 168, 167, 166, 165, 164, 163, 162, 161,
+ 160, 159, 158, 154, 153, 152, 151, 150, 149, 148,
+ 145, 107, 143, 142, 141, 140, 139, 138, 137, 136,
+ 135, 134, 133, 130, 129, 125, 124, 123, 122, 121,
+ 120, 119, 118, 115, 113, 113, 57, 111, 109, 97,
+ 96, 89, 86, 83, 82, 77, 76, 67, 57, 55,
+ 227, 54, 54, 52, 52, 11, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227
} ;
-static yyconst flex_int16_t yy_chk[419] =
+static yyconst flex_int16_t yy_chk[421] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -566,43 +565,43 @@ static yyconst flex_int16_t yy_chk[419] =
19, 19, 20, 20, 5, 21, 21, 6, 22, 22,
24, 24, 46, 33, 37, 37, 27, 33, 27, 3,
4, 5, 27, 27, 6, 30, 20, 35, 38, 21,
- 73, 39, 86, 30, 46, 221, 35, 30, 39, 221,
+ 73, 39, 49, 30, 46, 86, 35, 30, 39, 49,
+
+ 38, 119, 30, 83, 83, 128, 224, 128, 73, 86,
+ 128, 219, 46, 168, 119, 168, 46, 83, 168, 222,
+ 217, 212, 211, 222, 228, 228, 228, 228, 228, 228,
+ 228, 228, 228, 228, 228, 229, 229, 229, 229, 229,
+ 229, 229, 229, 229, 229, 229, 230, 230, 230, 230,
+ 230, 230, 230, 230, 230, 230, 230, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 232, 232,
+ 232, 232, 233, 210, 233, 233, 233, 233, 234, 209,
+ 208, 234, 235, 235, 235, 235, 236, 236, 236, 236,
+ 237, 237, 207, 204, 203, 237, 237, 238, 238, 202,
+
+ 199, 238, 238, 238, 238, 238, 238, 239, 239, 239,
+ 239, 239, 239, 239, 239, 239, 239, 239, 240, 240,
+ 198, 240, 240, 196, 240, 240, 240, 240, 241, 241,
+ 195, 241, 241, 241, 241, 241, 241, 241, 241, 242,
+ 242, 242, 194, 242, 242, 242, 242, 242, 242, 242,
+ 243, 243, 193, 243, 243, 243, 243, 243, 243, 243,
+ 243, 244, 244, 245, 245, 246, 246, 192, 190, 189,
+ 188, 187, 186, 185, 184, 183, 179, 178, 177, 176,
+ 174, 173, 172, 165, 164, 162, 161, 160, 158, 156,
+ 155, 154, 153, 152, 151, 150, 149, 148, 147, 146,
+
+ 145, 142, 141, 140, 139, 138, 137, 135, 134, 133,
+ 131, 130, 129, 127, 126, 125, 124, 122, 121, 120,
+ 118, 106, 98, 97, 96, 95, 94, 93, 92, 91,
+ 90, 89, 87, 85, 84, 82, 81, 80, 79, 78,
+ 77, 76, 74, 72, 63, 62, 58, 54, 50, 41,
+ 40, 36, 34, 32, 31, 29, 28, 23, 18, 15,
+ 11, 10, 9, 8, 7, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 38, 118, 30, 83, 83, 127, 86, 127, 73, 223,
- 127, 218, 46, 167, 118, 167, 46, 83, 167, 227,
227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 228, 228, 228, 228, 228, 228, 228, 228, 228, 228,
- 228, 229, 229, 229, 229, 229, 229, 229, 229, 229,
- 229, 229, 230, 230, 230, 230, 230, 230, 230, 230,
- 230, 230, 230, 231, 231, 231, 231, 232, 216, 232,
- 232, 232, 232, 233, 211, 210, 233, 234, 234, 234,
- 234, 235, 235, 235, 235, 236, 236, 209, 208, 207,
- 236, 236, 237, 237, 206, 203, 237, 237, 237, 237,
-
- 237, 237, 238, 238, 238, 238, 238, 238, 238, 238,
- 238, 238, 238, 239, 239, 202, 239, 239, 201, 239,
- 239, 239, 239, 240, 240, 198, 240, 240, 240, 240,
- 240, 240, 240, 240, 241, 241, 241, 197, 241, 241,
- 241, 241, 241, 241, 241, 242, 242, 195, 242, 242,
- 242, 242, 242, 242, 242, 242, 243, 243, 244, 244,
- 245, 245, 194, 193, 192, 191, 189, 188, 187, 186,
- 185, 184, 183, 182, 178, 177, 176, 175, 173, 172,
- 171, 164, 163, 161, 160, 159, 157, 155, 154, 153,
- 152, 151, 150, 149, 148, 147, 146, 145, 144, 141,
-
- 140, 139, 138, 137, 136, 134, 133, 132, 130, 129,
- 128, 126, 125, 124, 123, 121, 120, 119, 117, 98,
- 97, 96, 95, 94, 93, 92, 91, 90, 89, 87,
- 85, 84, 82, 81, 80, 79, 78, 77, 76, 74,
- 72, 63, 62, 58, 54, 50, 49, 41, 40, 36,
- 34, 32, 31, 29, 28, 23, 18, 15, 11, 10,
- 9, 8, 7, 226, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
-
- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 226
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227
} ;
/* Table of booleans, true if rule could match eol. */
@@ -687,7 +686,7 @@ limitations under the License.
-#line 691 "lexer.c"
+#line 690 "lexer.c"
#define INITIAL 0
#define str 1
@@ -925,7 +924,7 @@ YY_DECL
#line 86 "lexer.l"
-#line 929 "lexer.c"
+#line 928 "lexer.c"
yylval = yylval_param;
@@ -980,13 +979,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 227 )
+ if ( yy_current_state >= 228 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 364 );
+ while ( yy_base[yy_current_state] != 366 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1596,11 +1595,13 @@ YY_RULE_SETUP
BEGIN(INITIAL);
s = (SIZED_STRING*) yr_malloc(yyextra->lex_buf_len + sizeof(SIZED_STRING));
+ s->flags = 0;
if (yytext[1] == 'i')
- s->flags = SIZED_STRING_FLAGS_NO_CASE;
- else
- s->flags = 0;
+ s->flags |= SIZED_STRING_FLAGS_NO_CASE;
+
+ if (yytext[1] == 's' || yytext[2] == 's')
+ s->flags |= SIZED_STRING_FLAGS_DOT_ALL;
s->length = yyextra->lex_buf_len;
strcpy(s->c_string, yyextra->lex_buf);
@@ -1612,7 +1613,7 @@ YY_RULE_SETUP
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 439 "lexer.l"
+#line 441 "lexer.l"
{
LEX_CHECK_SPACE_OK("/", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1622,7 +1623,7 @@ YY_RULE_SETUP
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 447 "lexer.l"
+#line 449 "lexer.l"
{
LEX_CHECK_SPACE_OK("\\.", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1633,13 +1634,13 @@ YY_RULE_SETUP
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 456 "lexer.l"
+#line 458 "lexer.l"
{ YYTEXT_TO_BUFFER; }
YY_BREAK
case 72:
/* rule 72 can match eol */
YY_RULE_SETUP
-#line 459 "lexer.l"
+#line 461 "lexer.l"
{
yyerror(yyscanner, "unterminated regular expression");
@@ -1648,7 +1649,7 @@ YY_RULE_SETUP
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 466 "lexer.l"
+#line 468 "lexer.l"
{
yyextra->lex_buf_ptr = yyextra->lex_buf;
@@ -1658,7 +1659,7 @@ YY_RULE_SETUP
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 474 "lexer.l"
+#line 476 "lexer.l"
{
yyextra->lex_buf_ptr = yyextra->lex_buf;
@@ -1669,7 +1670,7 @@ YY_RULE_SETUP
case 75:
/* rule 75 can match eol */
YY_RULE_SETUP
-#line 482 "lexer.l"
+#line 484 "lexer.l"
{
int len = strlen(yytext);
@@ -1687,12 +1688,12 @@ YY_RULE_SETUP
case 76:
/* rule 76 can match eol */
YY_RULE_SETUP
-#line 497 "lexer.l"
+#line 499 "lexer.l"
/* skip whitespace */
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 499 "lexer.l"
+#line 501 "lexer.l"
{
if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1708,10 +1709,10 @@ YY_RULE_SETUP
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 512 "lexer.l"
+#line 514 "lexer.l"
ECHO;
YY_BREAK
-#line 1715 "lexer.c"
+#line 1716 "lexer.c"
case YY_END_OF_BUFFER:
{
@@ -2003,7 +2004,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 227 )
+ if ( yy_current_state >= 228 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2032,11 +2033,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 227 )
+ if ( yy_current_state >= 228 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 226);
+ yy_is_jam = (yy_current_state == 227);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2844,7 +2845,7 @@ void yara_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 512 "lexer.l"
+#line 514 "lexer.l"
diff --git a/libyara/lexer.l b/libyara/lexer.l
index 8fead07..b6233ad 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -407,7 +407,7 @@ $({letter}|{digit}|_)* {
}
-<regexp>\/i? {
+<regexp>\/i?s? {
SIZED_STRING* s;
@@ -421,11 +421,13 @@ $({letter}|{digit}|_)* {
BEGIN(INITIAL);
s = (SIZED_STRING*) yr_malloc(yyextra->lex_buf_len + sizeof(SIZED_STRING));
+ s->flags = 0;
if (yytext[1] == 'i')
- s->flags = SIZED_STRING_FLAGS_NO_CASE;
- else
- s->flags = 0;
+ s->flags |= SIZED_STRING_FLAGS_NO_CASE;
+
+ if (yytext[1] == 's' || yytext[2] == 's')
+ s->flags |= SIZED_STRING_FLAGS_DOT_ALL;
s->length = yyextra->lex_buf_len;
strcpy(s->c_string, yyextra->lex_buf);
diff --git a/libyara/parser.c b/libyara/parser.c
index 6ac72ed..4728ae8 100644
--- a/libyara/parser.c
+++ b/libyara/parser.c
@@ -412,6 +412,9 @@ YR_STRING* yr_parser_reduce_string_declaration(
if (str->flags & SIZED_STRING_FLAGS_NO_CASE)
flags |= STRING_GFLAGS_NO_CASE;
+ if (str->flags & SIZED_STRING_FLAGS_DOT_ALL)
+ flags |= STRING_GFLAGS_REGEXP_DOT_ALL;
+
// The STRING_GFLAGS_SINGLE_MATCH flag indicates that finding
// a single match for the string is enough. This is true in
// most cases, except when the string count (#) and string offset (@)
diff --git a/libyara/rules.c b/libyara/rules.c
index 2e82160..155ab75 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -662,7 +662,8 @@ int _yr_scan_verify_re_match(
if (STRING_IS_NO_CASE(ac_match->string))
flags |= RE_FLAGS_NO_CASE;
- if (STRING_IS_HEX(ac_match->string))
+ if (STRING_IS_HEX(ac_match->string) ||
+ STRING_IS_REGEXP_DOT_ALL(ac_match->string))
flags |= RE_FLAGS_DOT_ALL;
if (STRING_IS_ASCII(ac_match->string))
diff --git a/libyara/sizedstr.h b/libyara/sizedstr.h
index 247e7b7..5ca2aac 100644
--- a/libyara/sizedstr.h
+++ b/libyara/sizedstr.h
@@ -23,7 +23,8 @@ limitations under the License.
// terminated with a null char.
//
-#define SIZED_STRING_FLAGS_NO_CASE 1
+#define SIZED_STRING_FLAGS_NO_CASE 1
+#define SIZED_STRING_FLAGS_DOT_ALL 2
typedef struct _SIZED_STRING
{
diff --git a/libyara/yara.h b/libyara/yara.h
index 1f7cc2e..e581b5d 100644
--- a/libyara/yara.h
+++ b/libyara/yara.h
@@ -174,6 +174,7 @@ typedef int32_t tidx_mask_t;
#define STRING_GFLAGS_NULL 0x1000
#define STRING_GFLAGS_CHAIN_PART 0x2000
#define STRING_GFLAGS_CHAIN_TAIL 0x4000
+#define STRING_GFLAGS_REGEXP_DOT_ALL 0x8000
#define STRING_IS_HEX(x) \
(((x)->g_flags) & STRING_GFLAGS_HEXADECIMAL)
@@ -190,6 +191,9 @@ typedef int32_t tidx_mask_t;
#define STRING_IS_REGEXP(x) \
(((x)->g_flags) & STRING_GFLAGS_REGEXP)
+#define STRING_IS_REGEXP_DOT_ALL(x) \
+ (((x)->g_flags) & STRING_GFLAGS_REGEXP_DOT_ALL)
+
#define STRING_IS_FULL_WORD(x) \
(((x)->g_flags) & STRING_GFLAGS_FULL_WORD)
--
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