[Forensics-changes] [yara] 75/368: Force parsers to user yr_malloc/yr_free

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:30:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.5.0
in repository yara.

commit 60de3cc8a065a4b8fb9da11385b04b34e6420d1d
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Thu Sep 24 14:44:13 2015 +0200

    Force parsers to user yr_malloc/yr_free
---
 libyara/grammar.c     | 285 +++++++++++++++++++++++++-------------------------
 libyara/grammar.h     |   2 +-
 libyara/grammar.y     |   3 +
 libyara/hex_grammar.c |  85 +++++++--------
 libyara/hex_grammar.h |   2 +-
 libyara/hex_grammar.y |   3 +
 libyara/re_grammar.c  |  99 +++++++++---------
 libyara/re_grammar.h  |   2 +-
 libyara/re_grammar.y  |   3 +
 9 files changed, 251 insertions(+), 233 deletions(-)

diff --git a/libyara/grammar.c b/libyara/grammar.c
index 2f3a6cf..db190c0 100644
--- a/libyara/grammar.c
+++ b/libyara/grammar.c
@@ -205,6 +205,9 @@
 
 #define YYERROR_VERBOSE
 
+#define YYMALLOC yr_malloc
+#define YYFREE yr_free
+
 #define INTEGER_SET_ENUMERATION   1
 #define INTEGER_SET_RANGE         2
 
@@ -264,7 +267,7 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 183 "grammar.y"
+#line 186 "grammar.y"
 {
   EXPRESSION      expression;
   SIZED_STRING*   sized_string;
@@ -276,7 +279,7 @@ typedef union YYSTYPE
   YR_RULE*        rule;
 }
 /* Line 193 of yacc.c.  */
-#line 280 "grammar.c"
+#line 283 "grammar.c"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -289,7 +292,7 @@ typedef union YYSTYPE
 
 
 /* Line 216 of yacc.c.  */
-#line 293 "grammar.c"
+#line 296 "grammar.c"
 
 #ifdef short
 # undef short
@@ -623,18 +626,18 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   197,   197,   199,   200,   201,   202,   203,   208,   221,
-     220,   245,   248,   276,   279,   306,   311,   312,   317,   318,
-     324,   327,   345,   358,   395,   396,   401,   417,   430,   443,
-     460,   461,   466,   477,   476,   492,   506,   507,   512,   513,
-     514,   515,   520,   605,   651,   709,   754,   755,   759,   784,
-     820,   866,   881,   890,   899,   914,   926,   940,   953,   965,
-     995,   964,  1111,  1110,  1190,  1196,  1203,  1202,  1265,  1264,
-    1325,  1334,  1343,  1352,  1361,  1370,  1379,  1383,  1391,  1392,
-    1397,  1419,  1431,  1447,  1446,  1452,  1461,  1462,  1467,  1472,
-    1481,  1482,  1486,  1494,  1498,  1508,  1522,  1538,  1548,  1557,
-    1581,  1593,  1605,  1621,  1633,  1649,  1693,  1712,  1730,  1748,
-    1766,  1792,  1810,  1820,  1830,  1840,  1850,  1860,  1870
+       0,   200,   200,   202,   203,   204,   205,   206,   211,   224,
+     223,   248,   251,   279,   282,   309,   314,   315,   320,   321,
+     327,   330,   348,   361,   398,   399,   404,   420,   433,   446,
+     463,   464,   469,   480,   479,   495,   509,   510,   515,   516,
+     517,   518,   523,   608,   654,   712,   757,   758,   762,   787,
+     823,   869,   884,   893,   902,   917,   929,   943,   956,   968,
+     998,   967,  1114,  1113,  1193,  1199,  1206,  1205,  1268,  1267,
+    1328,  1337,  1346,  1355,  1364,  1373,  1382,  1386,  1394,  1395,
+    1400,  1422,  1434,  1450,  1449,  1455,  1464,  1465,  1470,  1475,
+    1484,  1485,  1489,  1497,  1501,  1511,  1525,  1541,  1551,  1560,
+    1584,  1596,  1608,  1624,  1636,  1652,  1696,  1715,  1733,  1751,
+    1769,  1795,  1813,  1823,  1833,  1843,  1853,  1863,  1873
 };
 #endif
 
@@ -1429,49 +1432,49 @@ yydestruct (yymsg, yytype, yyvaluep, yyscanner, compiler)
   switch (yytype)
     {
       case 10: /* "_IDENTIFIER_" */
-#line 173 "grammar.y"
+#line 176 "grammar.y"
 	{ yr_free((yyvaluep->c_string)); };
-#line 1435 "grammar.c"
+#line 1438 "grammar.c"
 	break;
       case 11: /* "_STRING_IDENTIFIER_" */
-#line 177 "grammar.y"
+#line 180 "grammar.y"
 	{ yr_free((yyvaluep->c_string)); };
-#line 1440 "grammar.c"
+#line 1443 "grammar.c"
 	break;
       case 12: /* "_STRING_COUNT_" */
-#line 174 "grammar.y"
+#line 177 "grammar.y"
 	{ yr_free((yyvaluep->c_string)); };
-#line 1445 "grammar.c"
+#line 1448 "grammar.c"
 	break;
       case 13: /* "_STRING_OFFSET_" */
-#line 175 "grammar.y"
+#line 178 "grammar.y"
 	{ yr_free((yyvaluep->c_string)); };
-#line 1450 "grammar.c"
+#line 1453 "grammar.c"
 	break;
       case 14: /* "_STRING_LENGTH_" */
-#line 176 "grammar.y"
+#line 179 "grammar.y"
 	{ yr_free((yyvaluep->c_string)); };
-#line 1455 "grammar.c"
+#line 1458 "grammar.c"
 	break;
       case 15: /* "_STRING_IDENTIFIER_WITH_WILDCARD_" */
-#line 178 "grammar.y"
+#line 181 "grammar.y"
 	{ yr_free((yyvaluep->c_string)); };
-#line 1460 "grammar.c"
+#line 1463 "grammar.c"
 	break;
       case 19: /* "_TEXT_STRING_" */
-#line 179 "grammar.y"
+#line 182 "grammar.y"
 	{ yr_free((yyvaluep->sized_string)); };
-#line 1465 "grammar.c"
+#line 1468 "grammar.c"
 	break;
       case 20: /* "_HEX_STRING_" */
-#line 180 "grammar.y"
+#line 183 "grammar.y"
 	{ yr_free((yyvaluep->sized_string)); };
-#line 1470 "grammar.c"
+#line 1473 "grammar.c"
 	break;
       case 21: /* "_REGEXP_" */
-#line 181 "grammar.y"
+#line 184 "grammar.y"
 	{ yr_free((yyvaluep->sized_string)); };
-#line 1475 "grammar.c"
+#line 1478 "grammar.c"
 	break;
 
       default:
@@ -1781,7 +1784,7 @@ yyreduce:
   switch (yyn)
     {
         case 8:
-#line 209 "grammar.y"
+#line 212 "grammar.y"
     {
         int result = yr_parser_reduce_import(yyscanner, (yyvsp[(2) - (2)].sized_string));
 
@@ -1792,7 +1795,7 @@ yyreduce:
     break;
 
   case 9:
-#line 221 "grammar.y"
+#line 224 "grammar.y"
     {
         YR_RULE* rule = yr_parser_reduce_rule_declaration_phase_1(
             yyscanner, (int32_t) (yyvsp[(1) - (7)].integer), (yyvsp[(3) - (7)].c_string), (yyvsp[(4) - (7)].c_string), (yyvsp[(7) - (7)].string), (yyvsp[(6) - (7)].meta));
@@ -1804,7 +1807,7 @@ yyreduce:
     break;
 
   case 10:
-#line 230 "grammar.y"
+#line 233 "grammar.y"
     {
         YR_RULE* rule = (yyvsp[(8) - (10)].rule); // rule created in phase 1
 
@@ -1818,14 +1821,14 @@ yyreduce:
     break;
 
   case 11:
-#line 245 "grammar.y"
+#line 248 "grammar.y"
     {
         (yyval.meta) = NULL;
       }
     break;
 
   case 12:
-#line 249 "grammar.y"
+#line 252 "grammar.y"
     {
         // Each rule have a list of meta-data info, consisting in a
         // sequence of YR_META structures. The last YR_META structure does
@@ -1851,14 +1854,14 @@ yyreduce:
     break;
 
   case 13:
-#line 276 "grammar.y"
+#line 279 "grammar.y"
     {
         (yyval.string) = NULL;
       }
     break;
 
   case 14:
-#line 280 "grammar.y"
+#line 283 "grammar.y"
     {
         // Each rule have a list of strings, consisting in a sequence
         // of YR_STRING structures. The last YR_STRING structure does not
@@ -1884,34 +1887,34 @@ yyreduce:
     break;
 
   case 16:
-#line 311 "grammar.y"
+#line 314 "grammar.y"
     { (yyval.integer) = 0;  }
     break;
 
   case 17:
-#line 312 "grammar.y"
+#line 315 "grammar.y"
     { (yyval.integer) = (yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer); }
     break;
 
   case 18:
-#line 317 "grammar.y"
+#line 320 "grammar.y"
     { (yyval.integer) = RULE_GFLAGS_PRIVATE; }
     break;
 
   case 19:
-#line 318 "grammar.y"
+#line 321 "grammar.y"
     { (yyval.integer) = RULE_GFLAGS_GLOBAL; }
     break;
 
   case 20:
-#line 324 "grammar.y"
+#line 327 "grammar.y"
     {
         (yyval.c_string) = NULL;
       }
     break;
 
   case 21:
-#line 328 "grammar.y"
+#line 331 "grammar.y"
     {
         // Tags list is represented in the arena as a sequence
         // of null-terminated strings, the sequence ends with an
@@ -1928,7 +1931,7 @@ yyreduce:
     break;
 
   case 22:
-#line 346 "grammar.y"
+#line 349 "grammar.y"
     {
         char* identifier;
 
@@ -1944,7 +1947,7 @@ yyreduce:
     break;
 
   case 23:
-#line 359 "grammar.y"
+#line 362 "grammar.y"
     {
         char* tag_name = (yyvsp[(1) - (2)].c_string);
         size_t tag_length = tag_name != NULL ? strlen(tag_name) : 0;
@@ -1979,17 +1982,17 @@ yyreduce:
     break;
 
   case 24:
-#line 395 "grammar.y"
+#line 398 "grammar.y"
     {  (yyval.meta) = (yyvsp[(1) - (1)].meta); }
     break;
 
   case 25:
-#line 396 "grammar.y"
+#line 399 "grammar.y"
     {  (yyval.meta) = (yyvsp[(1) - (2)].meta); }
     break;
 
   case 26:
-#line 402 "grammar.y"
+#line 405 "grammar.y"
     {
         SIZED_STRING* sized_string = (yyvsp[(3) - (3)].sized_string);
 
@@ -2008,7 +2011,7 @@ yyreduce:
     break;
 
   case 27:
-#line 418 "grammar.y"
+#line 421 "grammar.y"
     {
         (yyval.meta) = yr_parser_reduce_meta_declaration(
             yyscanner,
@@ -2024,7 +2027,7 @@ yyreduce:
     break;
 
   case 28:
-#line 431 "grammar.y"
+#line 434 "grammar.y"
     {
         (yyval.meta) = yr_parser_reduce_meta_declaration(
             yyscanner,
@@ -2040,7 +2043,7 @@ yyreduce:
     break;
 
   case 29:
-#line 444 "grammar.y"
+#line 447 "grammar.y"
     {
         (yyval.meta) = yr_parser_reduce_meta_declaration(
             yyscanner,
@@ -2056,17 +2059,17 @@ yyreduce:
     break;
 
   case 30:
-#line 460 "grammar.y"
+#line 463 "grammar.y"
     { (yyval.string) = (yyvsp[(1) - (1)].string); }
     break;
 
   case 31:
-#line 461 "grammar.y"
+#line 464 "grammar.y"
     { (yyval.string) = (yyvsp[(1) - (2)].string); }
     break;
 
   case 32:
-#line 467 "grammar.y"
+#line 470 "grammar.y"
     {
         (yyval.string) = yr_parser_reduce_string_declaration(
             yyscanner, (int32_t) (yyvsp[(4) - (4)].integer), (yyvsp[(1) - (4)].c_string), (yyvsp[(3) - (4)].sized_string));
@@ -2079,14 +2082,14 @@ yyreduce:
     break;
 
   case 33:
-#line 477 "grammar.y"
+#line 480 "grammar.y"
     {
         compiler->error_line = yyget_lineno(yyscanner);
       }
     break;
 
   case 34:
-#line 481 "grammar.y"
+#line 484 "grammar.y"
     {
         (yyval.string) = yr_parser_reduce_string_declaration(
             yyscanner, (int32_t) (yyvsp[(5) - (5)].integer) | STRING_GFLAGS_REGEXP, (yyvsp[(1) - (5)].c_string), (yyvsp[(4) - (5)].sized_string));
@@ -2101,7 +2104,7 @@ yyreduce:
     break;
 
   case 35:
-#line 493 "grammar.y"
+#line 496 "grammar.y"
     {
         (yyval.string) = yr_parser_reduce_string_declaration(
             yyscanner, STRING_GFLAGS_HEXADECIMAL, (yyvsp[(1) - (3)].c_string), (yyvsp[(3) - (3)].sized_string));
@@ -2114,37 +2117,37 @@ yyreduce:
     break;
 
   case 36:
-#line 506 "grammar.y"
+#line 509 "grammar.y"
     { (yyval.integer) = 0; }
     break;
 
   case 37:
-#line 507 "grammar.y"
+#line 510 "grammar.y"
     { (yyval.integer) = (yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer); }
     break;
 
   case 38:
-#line 512 "grammar.y"
+#line 515 "grammar.y"
     { (yyval.integer) = STRING_GFLAGS_WIDE; }
     break;
 
   case 39:
-#line 513 "grammar.y"
+#line 516 "grammar.y"
     { (yyval.integer) = STRING_GFLAGS_ASCII; }
     break;
 
   case 40:
-#line 514 "grammar.y"
+#line 517 "grammar.y"
     { (yyval.integer) = STRING_GFLAGS_NO_CASE; }
     break;
 
   case 41:
-#line 515 "grammar.y"
+#line 518 "grammar.y"
     { (yyval.integer) = STRING_GFLAGS_FULL_WORD; }
     break;
 
   case 42:
-#line 521 "grammar.y"
+#line 524 "grammar.y"
     {
         int var_index = yr_parser_lookup_loop_variable(yyscanner, (yyvsp[(1) - (1)].c_string));
 
@@ -2232,7 +2235,7 @@ yyreduce:
     break;
 
   case 43:
-#line 606 "grammar.y"
+#line 609 "grammar.y"
     {
         YR_OBJECT* field = NULL;
 
@@ -2281,7 +2284,7 @@ yyreduce:
     break;
 
   case 44:
-#line 652 "grammar.y"
+#line 655 "grammar.y"
     {
         YR_OBJECT_ARRAY* array;
         YR_OBJECT_DICTIONARY* dict;
@@ -2341,7 +2344,7 @@ yyreduce:
     break;
 
   case 45:
-#line 710 "grammar.y"
+#line 713 "grammar.y"
     {
         YR_OBJECT_FUNCTION* function;
         char* args_fmt;
@@ -2385,17 +2388,17 @@ yyreduce:
     break;
 
   case 46:
-#line 754 "grammar.y"
+#line 757 "grammar.y"
     { (yyval.c_string) = yr_strdup(""); }
     break;
 
   case 47:
-#line 755 "grammar.y"
+#line 758 "grammar.y"
     { (yyval.c_string) = (yyvsp[(1) - (1)].c_string); }
     break;
 
   case 48:
-#line 760 "grammar.y"
+#line 763 "grammar.y"
     {
         (yyval.c_string) = (char*) yr_malloc(MAX_FUNCTION_ARGS + 1);
 
@@ -2423,7 +2426,7 @@ yyreduce:
     break;
 
   case 49:
-#line 785 "grammar.y"
+#line 788 "grammar.y"
     {
         if (strlen((yyvsp[(1) - (3)].c_string)) == MAX_FUNCTION_ARGS)
         {
@@ -2458,7 +2461,7 @@ yyreduce:
     break;
 
   case 50:
-#line 821 "grammar.y"
+#line 824 "grammar.y"
     {
         SIZED_STRING* sized_string = (yyvsp[(1) - (1)].sized_string);
         RE* re;
@@ -2503,7 +2506,7 @@ yyreduce:
     break;
 
   case 51:
-#line 867 "grammar.y"
+#line 870 "grammar.y"
     {
         if ((yyvsp[(1) - (1)].expression).type == EXPRESSION_TYPE_STRING)
         {
@@ -2518,7 +2521,7 @@ yyreduce:
     break;
 
   case 52:
-#line 882 "grammar.y"
+#line 885 "grammar.y"
     {
         compiler->last_result = yr_parser_emit_with_arg(
             yyscanner, OP_PUSH, 1, NULL, NULL);
@@ -2530,7 +2533,7 @@ yyreduce:
     break;
 
   case 53:
-#line 891 "grammar.y"
+#line 894 "grammar.y"
     {
         compiler->last_result = yr_parser_emit_with_arg(
             yyscanner, OP_PUSH, 0, NULL, NULL);
@@ -2542,7 +2545,7 @@ yyreduce:
     break;
 
   case 54:
-#line 900 "grammar.y"
+#line 903 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(1) - (3)].expression), EXPRESSION_TYPE_STRING, "matches");
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_REGEXP, "matches");
@@ -2560,7 +2563,7 @@ yyreduce:
     break;
 
   case 55:
-#line 915 "grammar.y"
+#line 918 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(1) - (3)].expression), EXPRESSION_TYPE_STRING, "contains");
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_STRING, "contains");
@@ -2575,7 +2578,7 @@ yyreduce:
     break;
 
   case 56:
-#line 927 "grammar.y"
+#line 930 "grammar.y"
     {
         int result = yr_parser_reduce_string_identifier(
             yyscanner,
@@ -2592,7 +2595,7 @@ yyreduce:
     break;
 
   case 57:
-#line 941 "grammar.y"
+#line 944 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_INTEGER, "at");
 
@@ -2608,7 +2611,7 @@ yyreduce:
     break;
 
   case 58:
-#line 954 "grammar.y"
+#line 957 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_string_identifier(
             yyscanner, (yyvsp[(1) - (3)].c_string), OP_FOUND_IN, UNDEFINED);
@@ -2622,7 +2625,7 @@ yyreduce:
     break;
 
   case 59:
-#line 965 "grammar.y"
+#line 968 "grammar.y"
     {
         int var_index;
 
@@ -2655,7 +2658,7 @@ yyreduce:
     break;
 
   case 60:
-#line 995 "grammar.y"
+#line 998 "grammar.y"
     {
         int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth;
         uint8_t* addr;
@@ -2693,7 +2696,7 @@ yyreduce:
     break;
 
   case 61:
-#line 1030 "grammar.y"
+#line 1033 "grammar.y"
     {
         int mem_offset;
 
@@ -2777,7 +2780,7 @@ yyreduce:
     break;
 
   case 62:
-#line 1111 "grammar.y"
+#line 1114 "grammar.y"
     {
         int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth;
         uint8_t* addr;
@@ -2810,7 +2813,7 @@ yyreduce:
     break;
 
   case 63:
-#line 1141 "grammar.y"
+#line 1144 "grammar.y"
     {
         int mem_offset;
 
@@ -2863,7 +2866,7 @@ yyreduce:
     break;
 
   case 64:
-#line 1191 "grammar.y"
+#line 1194 "grammar.y"
     {
         yr_parser_emit(yyscanner, OP_OF, NULL);
 
@@ -2872,7 +2875,7 @@ yyreduce:
     break;
 
   case 65:
-#line 1197 "grammar.y"
+#line 1200 "grammar.y"
     {
         yr_parser_emit(yyscanner, OP_NOT, NULL);
 
@@ -2881,7 +2884,7 @@ yyreduce:
     break;
 
   case 66:
-#line 1203 "grammar.y"
+#line 1206 "grammar.y"
     {
         YR_FIXUP* fixup;
         int64_t* jmp_destination_addr;
@@ -2910,7 +2913,7 @@ yyreduce:
     break;
 
   case 67:
-#line 1229 "grammar.y"
+#line 1232 "grammar.y"
     {
         YR_FIXUP* fixup;
         uint8_t* and_addr;
@@ -2949,7 +2952,7 @@ yyreduce:
     break;
 
   case 68:
-#line 1265 "grammar.y"
+#line 1268 "grammar.y"
     {
         YR_FIXUP* fixup;
         int64_t* jmp_destination_addr;
@@ -2977,7 +2980,7 @@ yyreduce:
     break;
 
   case 69:
-#line 1290 "grammar.y"
+#line 1293 "grammar.y"
     {
         YR_FIXUP* fixup;
         uint8_t* or_addr;
@@ -3016,7 +3019,7 @@ yyreduce:
     break;
 
   case 70:
-#line 1326 "grammar.y"
+#line 1329 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, "<", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3028,7 +3031,7 @@ yyreduce:
     break;
 
   case 71:
-#line 1335 "grammar.y"
+#line 1338 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, ">", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3040,7 +3043,7 @@ yyreduce:
     break;
 
   case 72:
-#line 1344 "grammar.y"
+#line 1347 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, "<=", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3052,7 +3055,7 @@ yyreduce:
     break;
 
   case 73:
-#line 1353 "grammar.y"
+#line 1356 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, ">=", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3064,7 +3067,7 @@ yyreduce:
     break;
 
   case 74:
-#line 1362 "grammar.y"
+#line 1365 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, "==", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3076,7 +3079,7 @@ yyreduce:
     break;
 
   case 75:
-#line 1371 "grammar.y"
+#line 1374 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, "!=", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3088,31 +3091,31 @@ yyreduce:
     break;
 
   case 76:
-#line 1380 "grammar.y"
+#line 1383 "grammar.y"
     {
         (yyval.expression) = (yyvsp[(1) - (1)].expression);
       }
     break;
 
   case 77:
-#line 1384 "grammar.y"
+#line 1387 "grammar.y"
     {
         (yyval.expression) = (yyvsp[(2) - (3)].expression);
       }
     break;
 
   case 78:
-#line 1391 "grammar.y"
+#line 1394 "grammar.y"
     { (yyval.integer) = INTEGER_SET_ENUMERATION; }
     break;
 
   case 79:
-#line 1392 "grammar.y"
+#line 1395 "grammar.y"
     { (yyval.integer) = INTEGER_SET_RANGE; }
     break;
 
   case 80:
-#line 1398 "grammar.y"
+#line 1401 "grammar.y"
     {
         if ((yyvsp[(2) - (5)].expression).type != EXPRESSION_TYPE_INTEGER)
         {
@@ -3133,7 +3136,7 @@ yyreduce:
     break;
 
   case 81:
-#line 1420 "grammar.y"
+#line 1423 "grammar.y"
     {
         if ((yyvsp[(1) - (1)].expression).type != EXPRESSION_TYPE_INTEGER)
         {
@@ -3148,7 +3151,7 @@ yyreduce:
     break;
 
   case 82:
-#line 1432 "grammar.y"
+#line 1435 "grammar.y"
     {
         if ((yyvsp[(3) - (3)].expression).type != EXPRESSION_TYPE_INTEGER)
         {
@@ -3162,7 +3165,7 @@ yyreduce:
     break;
 
   case 83:
-#line 1447 "grammar.y"
+#line 1450 "grammar.y"
     {
         // Push end-of-list marker
         yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL, NULL);
@@ -3170,7 +3173,7 @@ yyreduce:
     break;
 
   case 85:
-#line 1453 "grammar.y"
+#line 1456 "grammar.y"
     {
         yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL, NULL);
         yr_parser_emit_pushes_for_strings(yyscanner, "$*");
@@ -3178,7 +3181,7 @@ yyreduce:
     break;
 
   case 88:
-#line 1468 "grammar.y"
+#line 1471 "grammar.y"
     {
         yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[(1) - (1)].c_string));
         yr_free((yyvsp[(1) - (1)].c_string));
@@ -3186,7 +3189,7 @@ yyreduce:
     break;
 
   case 89:
-#line 1473 "grammar.y"
+#line 1476 "grammar.y"
     {
         yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[(1) - (1)].c_string));
         yr_free((yyvsp[(1) - (1)].c_string));
@@ -3194,28 +3197,28 @@ yyreduce:
     break;
 
   case 91:
-#line 1483 "grammar.y"
+#line 1486 "grammar.y"
     {
         yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL, NULL);
       }
     break;
 
   case 92:
-#line 1487 "grammar.y"
+#line 1490 "grammar.y"
     {
         yr_parser_emit_with_arg(yyscanner, OP_PUSH, 1, NULL, NULL);
       }
     break;
 
   case 93:
-#line 1495 "grammar.y"
+#line 1498 "grammar.y"
     {
         (yyval.expression) = (yyvsp[(2) - (3)].expression);
       }
     break;
 
   case 94:
-#line 1499 "grammar.y"
+#line 1502 "grammar.y"
     {
         compiler->last_result = yr_parser_emit(
             yyscanner, OP_FILESIZE, NULL);
@@ -3228,7 +3231,7 @@ yyreduce:
     break;
 
   case 95:
-#line 1509 "grammar.y"
+#line 1512 "grammar.y"
     {
         yywarning(yyscanner,
             "Using deprecated \"entrypoint\" keyword. Use the \"entry_point\" "
@@ -3245,7 +3248,7 @@ yyreduce:
     break;
 
   case 96:
-#line 1523 "grammar.y"
+#line 1526 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(3) - (4)].expression), EXPRESSION_TYPE_INTEGER, "intXXXX or uintXXXX");
 
@@ -3264,7 +3267,7 @@ yyreduce:
     break;
 
   case 97:
-#line 1539 "grammar.y"
+#line 1542 "grammar.y"
     {
         compiler->last_result = yr_parser_emit_with_arg(
             yyscanner, OP_PUSH, (yyvsp[(1) - (1)].integer), NULL, NULL);
@@ -3277,7 +3280,7 @@ yyreduce:
     break;
 
   case 98:
-#line 1549 "grammar.y"
+#line 1552 "grammar.y"
     {
         compiler->last_result = yr_parser_emit_with_arg_double(
             yyscanner, OP_PUSH, (yyvsp[(1) - (1)].double_), NULL, NULL);
@@ -3289,7 +3292,7 @@ yyreduce:
     break;
 
   case 99:
-#line 1558 "grammar.y"
+#line 1561 "grammar.y"
     {
         SIZED_STRING* sized_string;
 
@@ -3316,7 +3319,7 @@ yyreduce:
     break;
 
   case 100:
-#line 1582 "grammar.y"
+#line 1585 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_string_identifier(
             yyscanner, (yyvsp[(1) - (1)].c_string), OP_COUNT, UNDEFINED);
@@ -3331,7 +3334,7 @@ yyreduce:
     break;
 
   case 101:
-#line 1594 "grammar.y"
+#line 1597 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_string_identifier(
             yyscanner, (yyvsp[(1) - (4)].c_string), OP_OFFSET, UNDEFINED);
@@ -3346,7 +3349,7 @@ yyreduce:
     break;
 
   case 102:
-#line 1606 "grammar.y"
+#line 1609 "grammar.y"
     {
         compiler->last_result = yr_parser_emit_with_arg(
             yyscanner, OP_PUSH, 1, NULL, NULL);
@@ -3365,7 +3368,7 @@ yyreduce:
     break;
 
   case 103:
-#line 1622 "grammar.y"
+#line 1625 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_string_identifier(
             yyscanner, (yyvsp[(1) - (4)].c_string), OP_LENGTH, UNDEFINED);
@@ -3380,7 +3383,7 @@ yyreduce:
     break;
 
   case 104:
-#line 1634 "grammar.y"
+#line 1637 "grammar.y"
     {
         compiler->last_result = yr_parser_emit_with_arg(
             yyscanner, OP_PUSH, 1, NULL, NULL);
@@ -3399,7 +3402,7 @@ yyreduce:
     break;
 
   case 105:
-#line 1650 "grammar.y"
+#line 1653 "grammar.y"
     {
         if ((yyvsp[(1) - (1)].expression).type == EXPRESSION_TYPE_INTEGER)  // loop identifier
         {
@@ -3446,7 +3449,7 @@ yyreduce:
     break;
 
   case 106:
-#line 1694 "grammar.y"
+#line 1697 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(2) - (2)].expression), EXPRESSION_TYPE_INTEGER | EXPRESSION_TYPE_FLOAT, "-");
 
@@ -3468,7 +3471,7 @@ yyreduce:
     break;
 
   case 107:
-#line 1713 "grammar.y"
+#line 1716 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, "+", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3489,7 +3492,7 @@ yyreduce:
     break;
 
   case 108:
-#line 1731 "grammar.y"
+#line 1734 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, "-", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3510,7 +3513,7 @@ yyreduce:
     break;
 
   case 109:
-#line 1749 "grammar.y"
+#line 1752 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, "*", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3531,7 +3534,7 @@ yyreduce:
     break;
 
   case 110:
-#line 1767 "grammar.y"
+#line 1770 "grammar.y"
     {
         compiler->last_result = yr_parser_reduce_operation(
             yyscanner, "\\", (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3560,7 +3563,7 @@ yyreduce:
     break;
 
   case 111:
-#line 1793 "grammar.y"
+#line 1796 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(1) - (3)].expression), EXPRESSION_TYPE_INTEGER, "%");
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_INTEGER, "%");
@@ -3581,7 +3584,7 @@ yyreduce:
     break;
 
   case 112:
-#line 1811 "grammar.y"
+#line 1814 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(1) - (3)].expression), EXPRESSION_TYPE_INTEGER, "^");
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_INTEGER, "^");
@@ -3594,7 +3597,7 @@ yyreduce:
     break;
 
   case 113:
-#line 1821 "grammar.y"
+#line 1824 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(1) - (3)].expression), EXPRESSION_TYPE_INTEGER, "^");
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_INTEGER, "^");
@@ -3607,7 +3610,7 @@ yyreduce:
     break;
 
   case 114:
-#line 1831 "grammar.y"
+#line 1834 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(1) - (3)].expression), EXPRESSION_TYPE_INTEGER, "|");
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_INTEGER, "|");
@@ -3620,7 +3623,7 @@ yyreduce:
     break;
 
   case 115:
-#line 1841 "grammar.y"
+#line 1844 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(2) - (2)].expression), EXPRESSION_TYPE_INTEGER, "~");
 
@@ -3633,7 +3636,7 @@ yyreduce:
     break;
 
   case 116:
-#line 1851 "grammar.y"
+#line 1854 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(1) - (3)].expression), EXPRESSION_TYPE_INTEGER, "<<");
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_INTEGER, "<<");
@@ -3646,7 +3649,7 @@ yyreduce:
     break;
 
   case 117:
-#line 1861 "grammar.y"
+#line 1864 "grammar.y"
     {
         CHECK_TYPE((yyvsp[(1) - (3)].expression), EXPRESSION_TYPE_INTEGER, ">>");
         CHECK_TYPE((yyvsp[(3) - (3)].expression), EXPRESSION_TYPE_INTEGER, ">>");
@@ -3659,7 +3662,7 @@ yyreduce:
     break;
 
   case 118:
-#line 1871 "grammar.y"
+#line 1874 "grammar.y"
     {
         (yyval.expression) = (yyvsp[(1) - (1)].expression);
       }
@@ -3667,7 +3670,7 @@ yyreduce:
 
 
 /* Line 1267 of yacc.c.  */
-#line 3671 "grammar.c"
+#line 3674 "grammar.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -3881,6 +3884,6 @@ yyreturn:
 }
 
 
-#line 1876 "grammar.y"
+#line 1879 "grammar.y"
 
 
diff --git a/libyara/grammar.h b/libyara/grammar.h
index 86d8162..92c7657 100644
--- a/libyara/grammar.h
+++ b/libyara/grammar.h
@@ -146,7 +146,7 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 183 "grammar.y"
+#line 186 "grammar.y"
 {
   EXPRESSION      expression;
   SIZED_STRING*   sized_string;
diff --git a/libyara/grammar.y b/libyara/grammar.y
index 8edffbe..846789c 100644
--- a/libyara/grammar.y
+++ b/libyara/grammar.y
@@ -38,6 +38,9 @@ limitations under the License.
 
 #define YYERROR_VERBOSE
 
+#define YYMALLOC yr_malloc
+#define YYFREE yr_free
+
 #define INTEGER_SET_ENUMERATION   1
 #define INTEGER_SET_RANGE         2
 
diff --git a/libyara/hex_grammar.c b/libyara/hex_grammar.c
index d52fca2..736d41f 100644
--- a/libyara/hex_grammar.c
+++ b/libyara/hex_grammar.c
@@ -107,6 +107,9 @@
 
 #define YYERROR_VERBOSE
 
+#define YYMALLOC yr_malloc
+#define YYFREE yr_free
+
 #define mark_as_not_fast_hex_regexp() \
     ((RE*) yyget_extra(yyscanner))->flags &= ~RE_FLAGS_FAST_HEX_REGEXP
 
@@ -145,13 +148,13 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 64 "hex_grammar.y"
+#line 67 "hex_grammar.y"
 {
   int64_t integer;
   RE_NODE *re_node;
 }
 /* Line 193 of yacc.c.  */
-#line 155 "hex_grammar.c"
+#line 158 "hex_grammar.c"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -164,7 +167,7 @@ typedef union YYSTYPE
 
 
 /* Line 216 of yacc.c.  */
-#line 168 "hex_grammar.c"
+#line 171 "hex_grammar.c"
 
 #ifdef short
 # undef short
@@ -454,9 +457,9 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,    91,    91,   100,   104,   113,   175,   179,   192,   196,
-     205,   219,   218,   231,   260,   298,   326,   352,   356,   370,
-     378
+       0,    94,    94,   103,   107,   116,   178,   182,   195,   199,
+     208,   222,   221,   234,   263,   301,   329,   355,   359,   373,
+     381
 };
 #endif
 
@@ -1081,39 +1084,39 @@ yydestruct (yymsg, yytype, yyvaluep, yyscanner, lex_env)
   switch (yytype)
     {
       case 16: /* "tokens" */
-#line 80 "hex_grammar.y"
+#line 83 "hex_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1087 "hex_grammar.c"
+#line 1090 "hex_grammar.c"
 	break;
       case 17: /* "token_sequence" */
-#line 81 "hex_grammar.y"
+#line 84 "hex_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1092 "hex_grammar.c"
+#line 1095 "hex_grammar.c"
 	break;
       case 18: /* "token_or_range" */
-#line 82 "hex_grammar.y"
+#line 85 "hex_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1097 "hex_grammar.c"
+#line 1100 "hex_grammar.c"
 	break;
       case 19: /* "token" */
-#line 83 "hex_grammar.y"
+#line 86 "hex_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1102 "hex_grammar.c"
+#line 1105 "hex_grammar.c"
 	break;
       case 21: /* "range" */
-#line 86 "hex_grammar.y"
+#line 89 "hex_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1107 "hex_grammar.c"
+#line 1110 "hex_grammar.c"
 	break;
       case 22: /* "alternatives" */
-#line 85 "hex_grammar.y"
+#line 88 "hex_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1112 "hex_grammar.c"
+#line 1115 "hex_grammar.c"
 	break;
       case 23: /* "byte" */
-#line 84 "hex_grammar.y"
+#line 87 "hex_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1117 "hex_grammar.c"
+#line 1120 "hex_grammar.c"
 	break;
 
       default:
@@ -1423,7 +1426,7 @@ yyreduce:
   switch (yyn)
     {
         case 2:
-#line 92 "hex_grammar.y"
+#line 95 "hex_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->root_node = (yyvsp[(2) - (3)].re_node);
@@ -1431,14 +1434,14 @@ yyreduce:
     break;
 
   case 3:
-#line 101 "hex_grammar.y"
+#line 104 "hex_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(1) - (1)].re_node);
       }
     break;
 
   case 4:
-#line 105 "hex_grammar.y"
+#line 108 "hex_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_CONCAT, (yyvsp[(1) - (2)].re_node), (yyvsp[(2) - (2)].re_node));
 
@@ -1450,7 +1453,7 @@ yyreduce:
     break;
 
   case 5:
-#line 114 "hex_grammar.y"
+#line 117 "hex_grammar.y"
     {
         RE_NODE* new_concat;
         RE_NODE* leftmost_concat = NULL;
@@ -1511,14 +1514,14 @@ yyreduce:
     break;
 
   case 6:
-#line 176 "hex_grammar.y"
+#line 179 "hex_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(1) - (1)].re_node);
       }
     break;
 
   case 7:
-#line 180 "hex_grammar.y"
+#line 183 "hex_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_CONCAT, (yyvsp[(1) - (2)].re_node), (yyvsp[(2) - (2)].re_node));
 
@@ -1530,14 +1533,14 @@ yyreduce:
     break;
 
   case 8:
-#line 193 "hex_grammar.y"
+#line 196 "hex_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(1) - (1)].re_node);
       }
     break;
 
   case 9:
-#line 197 "hex_grammar.y"
+#line 200 "hex_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(1) - (1)].re_node);
         (yyval.re_node)->greedy = FALSE;
@@ -1545,7 +1548,7 @@ yyreduce:
     break;
 
   case 10:
-#line 206 "hex_grammar.y"
+#line 209 "hex_grammar.y"
     {
         lex_env->token_count++;
 
@@ -1561,14 +1564,14 @@ yyreduce:
     break;
 
   case 11:
-#line 219 "hex_grammar.y"
+#line 222 "hex_grammar.y"
     {
         lex_env->inside_or++;
       }
     break;
 
   case 12:
-#line 223 "hex_grammar.y"
+#line 226 "hex_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(3) - (4)].re_node);
         lex_env->inside_or--;
@@ -1576,7 +1579,7 @@ yyreduce:
     break;
 
   case 13:
-#line 232 "hex_grammar.y"
+#line 235 "hex_grammar.y"
     {
         RE_NODE* re_any;
 
@@ -1608,7 +1611,7 @@ yyreduce:
     break;
 
   case 14:
-#line 261 "hex_grammar.y"
+#line 264 "hex_grammar.y"
     {
         RE_NODE* re_any;
 
@@ -1649,7 +1652,7 @@ yyreduce:
     break;
 
   case 15:
-#line 299 "hex_grammar.y"
+#line 302 "hex_grammar.y"
     {
         RE_NODE* re_any;
 
@@ -1680,7 +1683,7 @@ yyreduce:
     break;
 
   case 16:
-#line 327 "hex_grammar.y"
+#line 330 "hex_grammar.y"
     {
         RE_NODE* re_any;
 
@@ -1705,14 +1708,14 @@ yyreduce:
     break;
 
   case 17:
-#line 353 "hex_grammar.y"
+#line 356 "hex_grammar.y"
     {
           (yyval.re_node) = (yyvsp[(1) - (1)].re_node);
       }
     break;
 
   case 18:
-#line 357 "hex_grammar.y"
+#line 360 "hex_grammar.y"
     {
         mark_as_not_fast_hex_regexp();
 
@@ -1726,7 +1729,7 @@ yyreduce:
     break;
 
   case 19:
-#line 371 "hex_grammar.y"
+#line 374 "hex_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_LITERAL, NULL, NULL);
 
@@ -1737,7 +1740,7 @@ yyreduce:
     break;
 
   case 20:
-#line 379 "hex_grammar.y"
+#line 382 "hex_grammar.y"
     {
         uint8_t mask = (uint8_t) ((yyvsp[(1) - (1)].integer) >> 8);
 
@@ -1761,7 +1764,7 @@ yyreduce:
 
 
 /* Line 1267 of yacc.c.  */
-#line 1765 "hex_grammar.c"
+#line 1768 "hex_grammar.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1975,6 +1978,6 @@ yyreturn:
 }
 
 
-#line 400 "hex_grammar.y"
+#line 403 "hex_grammar.y"
 
 
diff --git a/libyara/hex_grammar.h b/libyara/hex_grammar.h
index 2186968..1b26d79 100644
--- a/libyara/hex_grammar.h
+++ b/libyara/hex_grammar.h
@@ -54,7 +54,7 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 64 "hex_grammar.y"
+#line 67 "hex_grammar.y"
 {
   int64_t integer;
   RE_NODE *re_node;
diff --git a/libyara/hex_grammar.y b/libyara/hex_grammar.y
index 9a4e6d0..0e0d1ac 100644
--- a/libyara/hex_grammar.y
+++ b/libyara/hex_grammar.y
@@ -32,6 +32,9 @@ limitations under the License.
 
 #define YYERROR_VERBOSE
 
+#define YYMALLOC yr_malloc
+#define YYFREE yr_free
+
 #define mark_as_not_fast_hex_regexp() \
     ((RE*) yyget_extra(yyscanner))->flags &= ~RE_FLAGS_FAST_HEX_REGEXP
 
diff --git a/libyara/re_grammar.c b/libyara/re_grammar.c
index 83dc25f..88fb0ab 100644
--- a/libyara/re_grammar.c
+++ b/libyara/re_grammar.c
@@ -121,6 +121,9 @@
 
 #define YYERROR_VERBOSE
 
+#define YYMALLOC yr_malloc
+#define YYFREE yr_free
+
 #define ERROR_IF(x, error) \
     if (x) \
     { \
@@ -156,7 +159,7 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 57 "re_grammar.y"
+#line 60 "re_grammar.y"
 {
   int integer;
   uint32_t range;
@@ -164,7 +167,7 @@ typedef union YYSTYPE
   uint8_t* class_vector;
 }
 /* Line 193 of yacc.c.  */
-#line 168 "re_grammar.c"
+#line 171 "re_grammar.c"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -177,7 +180,7 @@ typedef union YYSTYPE
 
 
 /* Line 216 of yacc.c.  */
-#line 181 "re_grammar.c"
+#line 184 "re_grammar.c"
 
 #ifdef short
 # undef short
@@ -470,10 +473,10 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,    88,    88,    93,    97,   101,   110,   124,   128,   139,
-     149,   161,   171,   183,   196,   210,   223,   237,   241,   247,
-     253,   259,   268,   272,   278,   286,   292,   298,   304,   310,
-     316,   322
+       0,    91,    91,    96,   100,   104,   113,   127,   131,   142,
+     152,   164,   174,   186,   199,   213,   226,   240,   244,   250,
+     256,   262,   271,   275,   281,   289,   295,   301,   307,   313,
+     319,   325
 };
 #endif
 
@@ -1104,29 +1107,29 @@ yydestruct (yymsg, yytype, yyvaluep, yyscanner, lex_env)
   switch (yytype)
     {
       case 6: /* "_CLASS_" */
-#line 80 "re_grammar.y"
+#line 83 "re_grammar.y"
 	{ yr_free((yyvaluep->class_vector)); };
-#line 1110 "re_grammar.c"
+#line 1113 "re_grammar.c"
 	break;
       case 26: /* "alternative" */
-#line 81 "re_grammar.y"
+#line 84 "re_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1115 "re_grammar.c"
+#line 1118 "re_grammar.c"
 	break;
       case 27: /* "concatenation" */
-#line 82 "re_grammar.y"
+#line 85 "re_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1120 "re_grammar.c"
+#line 1123 "re_grammar.c"
 	break;
       case 28: /* "repeat" */
-#line 83 "re_grammar.y"
+#line 86 "re_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1125 "re_grammar.c"
+#line 1128 "re_grammar.c"
 	break;
       case 29: /* "single" */
-#line 84 "re_grammar.y"
+#line 87 "re_grammar.y"
 	{ yr_re_node_destroy((yyvaluep->re_node)); };
-#line 1130 "re_grammar.c"
+#line 1133 "re_grammar.c"
 	break;
 
       default:
@@ -1436,7 +1439,7 @@ yyreduce:
   switch (yyn)
     {
         case 2:
-#line 89 "re_grammar.y"
+#line 92 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->root_node = (yyvsp[(1) - (1)].re_node);
@@ -1444,14 +1447,14 @@ yyreduce:
     break;
 
   case 4:
-#line 98 "re_grammar.y"
+#line 101 "re_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(1) - (1)].re_node);
       }
     break;
 
   case 5:
-#line 102 "re_grammar.y"
+#line 105 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_ALT, (yyvsp[(1) - (3)].re_node), (yyvsp[(3) - (3)].re_node));
 
@@ -1463,7 +1466,7 @@ yyreduce:
     break;
 
   case 6:
-#line 111 "re_grammar.y"
+#line 114 "re_grammar.y"
     {
         RE_NODE* node = yr_re_node_create(RE_NODE_EMPTY, NULL, NULL);
 
@@ -1477,14 +1480,14 @@ yyreduce:
     break;
 
   case 7:
-#line 125 "re_grammar.y"
+#line 128 "re_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(1) - (1)].re_node);
       }
     break;
 
   case 8:
-#line 129 "re_grammar.y"
+#line 132 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_CONCAT, (yyvsp[(1) - (2)].re_node), (yyvsp[(2) - (2)].re_node));
 
@@ -1495,7 +1498,7 @@ yyreduce:
     break;
 
   case 9:
-#line 140 "re_grammar.y"
+#line 143 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->flags |= RE_FLAGS_GREEDY;
@@ -1508,7 +1511,7 @@ yyreduce:
     break;
 
   case 10:
-#line 150 "re_grammar.y"
+#line 153 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->flags |= RE_FLAGS_UNGREEDY;
@@ -1523,7 +1526,7 @@ yyreduce:
     break;
 
   case 11:
-#line 162 "re_grammar.y"
+#line 165 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->flags |= RE_FLAGS_GREEDY;
@@ -1536,7 +1539,7 @@ yyreduce:
     break;
 
   case 12:
-#line 172 "re_grammar.y"
+#line 175 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->flags |= RE_FLAGS_UNGREEDY;
@@ -1551,7 +1554,7 @@ yyreduce:
     break;
 
   case 13:
-#line 184 "re_grammar.y"
+#line 187 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->flags |= RE_FLAGS_GREEDY;
@@ -1567,7 +1570,7 @@ yyreduce:
     break;
 
   case 14:
-#line 197 "re_grammar.y"
+#line 200 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->flags |= RE_FLAGS_UNGREEDY;
@@ -1584,7 +1587,7 @@ yyreduce:
     break;
 
   case 15:
-#line 211 "re_grammar.y"
+#line 214 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->flags |= RE_FLAGS_GREEDY;
@@ -1600,7 +1603,7 @@ yyreduce:
     break;
 
   case 16:
-#line 224 "re_grammar.y"
+#line 227 "re_grammar.y"
     {
         RE* re = yyget_extra(yyscanner);
         re->flags |= RE_FLAGS_UNGREEDY;
@@ -1617,14 +1620,14 @@ yyreduce:
     break;
 
   case 17:
-#line 238 "re_grammar.y"
+#line 241 "re_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(1) - (1)].re_node);
       }
     break;
 
   case 18:
-#line 242 "re_grammar.y"
+#line 245 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_WORD_BOUNDARY, NULL, NULL);
 
@@ -1633,7 +1636,7 @@ yyreduce:
     break;
 
   case 19:
-#line 248 "re_grammar.y"
+#line 251 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_NON_WORD_BOUNDARY, NULL, NULL);
 
@@ -1642,7 +1645,7 @@ yyreduce:
     break;
 
   case 20:
-#line 254 "re_grammar.y"
+#line 257 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_ANCHOR_START, NULL, NULL);
 
@@ -1651,7 +1654,7 @@ yyreduce:
     break;
 
   case 21:
-#line 260 "re_grammar.y"
+#line 263 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_ANCHOR_END, NULL, NULL);
 
@@ -1660,14 +1663,14 @@ yyreduce:
     break;
 
   case 22:
-#line 269 "re_grammar.y"
+#line 272 "re_grammar.y"
     {
         (yyval.re_node) = (yyvsp[(2) - (3)].re_node);
       }
     break;
 
   case 23:
-#line 273 "re_grammar.y"
+#line 276 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
 
@@ -1676,7 +1679,7 @@ yyreduce:
     break;
 
   case 24:
-#line 279 "re_grammar.y"
+#line 282 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_LITERAL, NULL, NULL);
 
@@ -1687,7 +1690,7 @@ yyreduce:
     break;
 
   case 25:
-#line 287 "re_grammar.y"
+#line 290 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_WORD_CHAR, NULL, NULL);
 
@@ -1696,7 +1699,7 @@ yyreduce:
     break;
 
   case 26:
-#line 293 "re_grammar.y"
+#line 296 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_NON_WORD_CHAR, NULL, NULL);
 
@@ -1705,7 +1708,7 @@ yyreduce:
     break;
 
   case 27:
-#line 299 "re_grammar.y"
+#line 302 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_SPACE, NULL, NULL);
 
@@ -1714,7 +1717,7 @@ yyreduce:
     break;
 
   case 28:
-#line 305 "re_grammar.y"
+#line 308 "re_grammar.y"
     {
          (yyval.re_node) = yr_re_node_create(RE_NODE_NON_SPACE, NULL, NULL);
 
@@ -1723,7 +1726,7 @@ yyreduce:
     break;
 
   case 29:
-#line 311 "re_grammar.y"
+#line 314 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_DIGIT, NULL, NULL);
 
@@ -1732,7 +1735,7 @@ yyreduce:
     break;
 
   case 30:
-#line 317 "re_grammar.y"
+#line 320 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_NON_DIGIT, NULL, NULL);
 
@@ -1741,7 +1744,7 @@ yyreduce:
     break;
 
   case 31:
-#line 323 "re_grammar.y"
+#line 326 "re_grammar.y"
     {
         (yyval.re_node) = yr_re_node_create(RE_NODE_CLASS, NULL, NULL);
 
@@ -1753,7 +1756,7 @@ yyreduce:
 
 
 /* Line 1267 of yacc.c.  */
-#line 1757 "re_grammar.c"
+#line 1760 "re_grammar.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1967,6 +1970,6 @@ yyreturn:
 }
 
 
-#line 331 "re_grammar.y"
+#line 334 "re_grammar.y"
 
 
diff --git a/libyara/re_grammar.h b/libyara/re_grammar.h
index c55856b..1ec60fb 100644
--- a/libyara/re_grammar.h
+++ b/libyara/re_grammar.h
@@ -72,7 +72,7 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 57 "re_grammar.y"
+#line 60 "re_grammar.y"
 {
   int integer;
   uint32_t range;
diff --git a/libyara/re_grammar.y b/libyara/re_grammar.y
index 14ecec3..e1b0b89 100644
--- a/libyara/re_grammar.y
+++ b/libyara/re_grammar.y
@@ -28,6 +28,9 @@ limitations under the License.
 
 #define YYERROR_VERBOSE
 
+#define YYMALLOC yr_malloc
+#define YYFREE yr_free
+
 #define ERROR_IF(x, error) \
     if (x) \
     { \

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