CVE-2016-10211 (Other, published 2017-04-03T05:59Z)
Description: value: libyara/grammar.y in YARA 3.5.0 allows remote attackers to cause a denial of service (use-after-free and application crash) via a crafted rule that is mishandled in the yr_parser_lookup_loop_variable function.
Severity: MEDIUM (CVSS v3 base score: 7.5)
Weakness: CWE-416 \u2014 Use After Free
The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.
Repository: https://github.com/VirusTotal/yara
Files changed:
libyara/grammar.c
libyara/grammar.y
Commit message: Fix issue #575


Vulnerable code:
#define YYLAST   408
#define YYNRULES  121
#define YYNSTATES  209
     994,  1007,  1019,  1049,  1018,  1163,  1162,  1241,  1247,  1254,
    1253,  1316,  1315,  1376,  1385,  1394,  1403,  1412,  1421,  1430,
    1434,  1442,  1443,  1448,  1470,  1482,  1498,  1497,  1503,  1514,
    1515,  1520,  1527,  1538,  1539,  1543,  1551,  1555,  1565,  1579,
    1595,  1605,  1614,  1639,  1651,  1663,  1679,  1691,  1707,  1752,
    1771,  1789,  1807,  1825,  1851,  1869,  1879,  1889,  1899,  1909,
    1919,  1929
#define YYTABLE_NINF -94
     -73,    79,   -73,   -32,    -4,   -73,   -73,    94,   -73,   -73,
     -73,   -73,    13,   -73,   -73,   -73,   -73,    -8,    72,     6,
     -73,    78,   111,   -73,    61,   122,   123,    82,   -73,    90,
     123,   -73,   147,   150,    16,   -73,    96,   147,   -73,   101,
      97,   -73,   -73,   -73,   -73,   151,    53,   -73,    48,   -73,
     -73,   -73,   149,   145,   -73,    -9,   -73,   103,   107,   -73,
     -73,   106,   -73,   -73,   -73,   -73,   -73,   -73,   110,   -73,
     -73,   135,    48,   135,    48,   -33,   -73,    64,   -73,   144,
     306,   -73,   -73,   135,   108,   135,   135,   135,   135,    -7,
     322,   -73,   -73,   -73,    64,   117,   163,   168,   135,    48,
     -73,   -73,    -6,   167,   135,   135,   135,   135,   135,   135,
     135,   135,   135,   135,   135,   135,   135,   135,   135,   135,
     135,    86,    86,   322,   135,   -73,   243,   261,   183,   203,
     159,    -6,   -73,   -73,   -73,   279,   121,   125,    95,    48,
      48,   -73,   -73,   -73,   -73,   322,   337,   351,   -43,   322,
     322,   322,   322,   322,   322,    40,    40,    58,    58,   -73,
     -73,   -73,   -73,   -73,   -73,   -73,   -73,   129,   -73,   -73,
     -73,   -73,   128,   -73,   -73,    48,   152,   -73,    15,   135,
     131,   -73,    95,   -73,   -73,    71,   -73,   223,   135,   133,
     -73,   132,   -73,    15,   -73,    73,   129,   -73,    48,   -73,
     -73,   135,   134,    31,   322,    48,   -73,    49,   -73
      29,    38,     0,     0,    45,    59,   103,   105,   107,   100,
     101,     0,   102,    53,    97,    98,    94,    95,     0,    55,
      56,     0,     0,     0,     0,   108,   121,    16,    54,     0,
      79,    39,    39,     0,     0,     0,     0,     0,     0,     0,
      93,   109,    68,   118,     0,    54,    79,     0,     0,    49,
      71,    69,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    80,    96,    46,     0,     0,    50,    51,     0,
       0,    88,    86,    67,    57,    58,   117,   115,   116,    77,
      78,    73,    75,    74,    76,   119,   120,   110,   111,   112,
     113,   114,    42,    41,    43,    44,    40,     0,   104,   106,
      99,    62,     0,    47,    48,     0,    72,    70,     0,     0,
       0,    65,    52,    91,    92,     0,    89,     0,     0,     0,
      82,     0,    87,     0,    83,     0,    84,    63,     0,    90,
      81,     0,     0,     0,    85,     0,    66,     0,    64
     -73,   -73,   199,   218,   -73,   -73,   -73,   -73,   -73,   -73,
     -73,   -73,   -73,   -73,   192,   -73,   186,   -73,   -73,   142,
     -73,   -73,   -73,   -73,   126,   -48,   -72,   -73,   -73,   -73,
     -73,   -73,   -73,    50,   -73,   100,   -73,   -73,    35,   164,
     166,    75,   136,   137,    76,    94,    78,   180,   202,   191,
     140,   139,   189,   125,   195,   143,   178,   185,   186,    79,
      77,    90,    95,   130,    91,     4,    93,    96,   114,   115,
     116,   117,   118,   119,   120,    11,   123,    83,   126,   127,
     128,   129,    84,    16,    92,   131,   183,   138,   141,     8,
     184,   135,    41,    97,    98,    42,    99,   145,   146,   147,
     148,   149,   150,   151,   152,   153,   154,   155,   156,   157,
     158,   159,   160,   161,    43,    44,    18,   167,    54,    55,
      56,    57,    58,   142,    59,    60,    61,    62,    22,    63,
      45,   100,   101,    51,   -36,    64,    65,    66,    67,     2,
       3,    68,    20,   -17,   -17,   -17,    69,    70,    23,   100,
     101,   176,   177,   116,   117,   118,   119,   120,    12,    13,
      14,   206,    71,   182,   100,   101,    72,    73,   162,   163,
     164,   165,   187,   118,   119,   120,     4,    74,    24,   208,
      54,   196,    56,    57,    58,    26,    59,    60,    61,    62,
      27,    63,   179,    29,   204,   -54,   -54,    64,    65,    66,
      67,   192,   193,   200,   201,    54,    32,    56,    57,    58,
     203,    59,    60,    61,    62,    34,    63,   207,    36,    39,
      49,    46,    64,    65,    71,    48,    82,    50,    81,    73,
      85,   105,   106,   107,    86,    87,   102,   124,   134,    88,
     114,   115,   116,   117,   118,   119,   120,   132,    63,    71,
     171,   174,   181,   101,    73,   -93,   175,   197,   103,   104,
     188,   198,     9,   205,    88,   105,   106,   107,   108,   109,
     110,   111,   112,   113,   114,   115,   116,   117,   118,   119,
     120,    10,    35,    47,   122,   105,   106,   107,   199,   144,
     190,   172,    89,   133,   114,   115,   116,   117,   118,   119,
     120,     0,     0,     0,     0,   105,   106,   107,     0,     0,
       0,     0,     0,   170,   114,   115,   116,   117,   118,   119,
     120,     0,     0,     0,     0,   105,   106,   107,     0,     0,
       0,     0,     0,   133,   114,   115,   116,   117,   118,   119,
     120,     0,     0,     0,     0,   105,   106,   107,     0,     0,
       0,     0,     0,   194,   114,   115,   116,   117,   118,   119,
     120,     0,     0,   105,   106,   107,     0,     0,     0,     0,
       0,   168,   114,   115,   116,   117,   118,   119,   120,     0,
       0,   105,   106,   107,     0,     0,     0,     0,     0,   169,
     114,   115,   116,   117,   118,   119,   120,     0,   -93,     0,
       0,   103,   104,     0,     0,     0,     0,   173,   105,   106,
     107,   108,   109,   110,   111,   112,   113,   114,   115,   116,
     117,   118,   119,   120,   105,   106,   107,     0,     0,     0,
     106,   107,     0,     0,     0,     0,     0,     0,   114,   115,
     116,   117,   118,   119,   120,   107,     0,     0,     0,     0,
       0,     0,   114,   115,   116,   117,   118,   119,   120
      48,    68,    74,    10,    71,    37,    73,    74,    51,    52,
      53,    54,    55,    56,    57,    19,    83,    26,    85,    86,
      87,    88,    31,    10,    72,    32,    11,    99,    34,    61,
      15,    98,    16,    66,    67,    19,    69,   104,   105,   106,
     117,   118,   119,   120,    38,    39,    64,   124,    10,    11,
      12,    13,    14,    69,    16,    17,    18,    19,    62,    21,
      54,    40,    41,    20,    21,    27,    28,    29,    30,     0,
       1,    33,    10,     4,     5,     6,    38,    39,    10,    40,
      41,   139,   140,    53,    54,    55,    56,    57,     4,     5,
       6,    70,    54,   175,    40,    41,    58,    59,    22,    23,
      24,    25,   179,    55,    56,    57,    37,    69,     7,    70,
      10,   188,    12,    13,    14,    64,    16,    17,    18,    19,
       8,    21,     3,    10,   201,    40,    41,    27,    28,    29,
      30,    70,    71,    70,    71,    10,    64,    12,    13,    14,
     198,    16,    17,    18,    19,    65,    21,   205,    11,     9,
      63,    65,    27,    28,    54,    64,    21,    16,    19,    59,
      67,    42,    43,    44,    67,    69,    32,    69,    10,    69,
      51,    52,    53,    54,    55,    56,    57,    70,    21,    54,
      31,    70,    64,    41,    59,    32,    71,    64,    35,    36,
      69,    69,     3,    69,    69,    42,    43,    44,    45,    46,
      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
      57,     3,    30,    37,    82,    42,    43,    44,   193,   103,
     180,   131,    68,    70,    51,    52,    53,    54,    55,    56,
      57,    -1,    -1,    -1,    -1,    42,    43,    44,    -1,    -1,
      -1,    -1,    -1,    70,    51,    52,    53,    54,    55,    56,
      57,    -1,    -1,    -1,    -1,    42,    43,    44,    -1,    -1,
      -1,    -1,    -1,    70,    51,    52,    53,    54,    55,    56,
      57,    -1,    -1,    -1,    -1,    42,    43,    44,    -1,    -1,
      -1,    -1,    -1,    70,    51,    52,    53,    54,    55,    56,
      57,    -1,    -1,    42,    43,    44,    -1,    -1,    -1,    -1,
      -1,    68,    51,    52,    53,    54,    55,    56,    57,    -1,
      -1,    42,    43,    44,    -1,    -1,    -1,    -1,    -1,    68,
      51,    52,    53,    54,    55,    56,    57,    -1,    32,    -1,
      -1,    35,    36,    -1,    -1,    -1,    -1,    68,    42,    43,
      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
      54,    55,    56,    57,    42,    43,    44,    -1,    -1,    -1,
      43,    44,    -1,    -1,    -1,    -1,    -1,    -1,    51,    52,
      53,    54,    55,    56,    57,    44,    -1,    -1,    -1,    -1,
      -1,    -1,    51,    52,    53,    54,    55,    56,    57
      10,    32,    70,    70,    10,   112,    94,    95,    98,   103,
     102,    34,    69,   107,    96,   112,   112,   112,   112,   112,
     112,   112,    22,    23,    24,    25,    92,   112,    68,    68,
      70,    31,   107,    68,    70,    71,    97,    97,   108,     3,
      99,    64,    98,    11,    15,   109,   110,   112,    69,   104,
     105,   101,    70,    71,    70,   106,   112,    64,    69,   110,
      70,    71,   100,    97,   112,    69,    70,    97,    70
      98,    98,    99,   100,    98,   101,    98,    98,    98,   102,
      98,   103,    98,    98,    98,    98,    98,    98,    98,    98,
      98,   104,   104,   105,   106,   106,   108,   107,   107,   109,
     109,   110,   110,   111,   111,   111,   112,   112,   112,   112,
     112,   112
       3,     3,     0,     0,    11,     0,     9,     3,     2,     0,
       4,     0,     4,     3,     3,     3,     3,     3,     3,     1,
       3,     3,     1,     5,     1,     3,     0,     4,     1,     1,
       3,     1,     1,     1,     1,     1,     3,     1,     1,     4,
       1,     1,     1,     1,     4,     1,     4,     1,     1,     2,
       3,     3,     3,     3,     3,     3,     3,     3,     2,     3,
       3,     1
#line 2619 "grammar.c" /* yacc.c:1646  */
  case 63:
#line 1049 "grammar.y" /* yacc.c:1646  */
#line 2658 "grammar.c" /* yacc.c:1646  */
  case 64:
#line 1084 "grammar.y" /* yacc.c:1646  */
#line 2741 "grammar.c" /* yacc.c:1646  */
  case 65:
#line 1163 "grammar.y" /* yacc.c:1646  */
#line 2775 "grammar.c" /* yacc.c:1646  */
  case 66:
#line 1193 "grammar.y" /* yacc.c:1646  */
#line 2828 "grammar.c" /* yacc.c:1646  */
  case 67:
#line 1242 "grammar.y" /* yacc.c:1646  */
#line 2838 "grammar.c" /* yacc.c:1646  */
  case 68:
#line 1248 "grammar.y" /* yacc.c:1646  */
#line 2848 "grammar.c" /* yacc.c:1646  */
  case 69:
#line 1254 "grammar.y" /* yacc.c:1646  */
#line 2878 "grammar.c" /* yacc.c:1646  */
  case 70:
#line 1280 "grammar.y" /* yacc.c:1646  */
#line 2918 "grammar.c" /* yacc.c:1646  */
  case 71:
#line 1316 "grammar.y" /* yacc.c:1646  */
#line 2947 "grammar.c" /* yacc.c:1646  */
  case 72:
#line 1341 "grammar.y" /* yacc.c:1646  */
#line 2987 "grammar.c" /* yacc.c:1646  */
  case 73:
#line 1377 "grammar.y" /* yacc.c:1646  */
#line 3000 "grammar.c" /* yacc.c:1646  */
  case 74:
#line 1386 "grammar.y" /* yacc.c:1646  */
#line 3013 "grammar.c" /* yacc.c:1646  */
  case 75:
#line 1395 "grammar.y" /* yacc.c:1646  */
#line 3026 "grammar.c" /* yacc.c:1646  */
  case 76:
#line 1404 "grammar.y" /* yacc.c:1646  */
#line 3039 "grammar.c" /* yacc.c:1646  */
  case 77:
#line 1413 "grammar.y" /* yacc.c:1646  */
#line 3052 "grammar.c" /* yacc.c:1646  */
  case 78:
#line 1422 "grammar.y" /* yacc.c:1646  */
#line 3065 "grammar.c" /* yacc.c:1646  */
  case 79:
#line 1431 "grammar.y" /* yacc.c:1646  */
#line 3073 "grammar.c" /* yacc.c:1646  */
  case 80:
#line 1435 "grammar.y" /* yacc.c:1646  */
#line 3081 "grammar.c" /* yacc.c:1646  */
  case 81:
#line 1442 "grammar.y" /* yacc.c:1646  */
#line 3087 "grammar.c" /* yacc.c:1646  */
  case 82:
#line 1443 "grammar.y" /* yacc.c:1646  */
#line 3093 "grammar.c" /* yacc.c:1646  */
  case 83:
#line 1449 "grammar.y" /* yacc.c:1646  */
#line 3115 "grammar.c" /* yacc.c:1646  */
  case 84:
#line 1471 "grammar.y" /* yacc.c:1646  */
#line 3131 "grammar.c" /* yacc.c:1646  */
  case 85:
#line 1483 "grammar.y" /* yacc.c:1646  */
#line 3146 "grammar.c" /* yacc.c:1646  */
  case 86:
#line 1498 "grammar.y" /* yacc.c:1646  */
#line 3155 "grammar.c" /* yacc.c:1646  */
  case 88:
#line 1504 "grammar.y" /* yacc.c:1646  */
#line 3166 "grammar.c" /* yacc.c:1646  */
  case 91:
#line 1521 "grammar.y" /* yacc.c:1646  */
#line 3177 "grammar.c" /* yacc.c:1646  */
  case 92:
#line 1528 "grammar.y" /* yacc.c:1646  */
#line 3188 "grammar.c" /* yacc.c:1646  */
  case 94:
#line 1540 "grammar.y" /* yacc.c:1646  */
#line 3196 "grammar.c" /* yacc.c:1646  */
  case 95:
#line 1544 "grammar.y" /* yacc.c:1646  */
#line 3204 "grammar.c" /* yacc.c:1646  */
  case 96:
#line 1552 "grammar.y" /* yacc.c:1646  */
#line 3212 "grammar.c" /* yacc.c:1646  */
  case 97:
#line 1556 "grammar.y" /* yacc.c:1646  */
#line 3226 "grammar.c" /* yacc.c:1646  */
  case 98:
#line 1566 "grammar.y" /* yacc.c:1646  */
#line 3244 "grammar.c" /* yacc.c:1646  */
  case 99:
#line 1580 "grammar.y" /* yacc.c:1646  */
#line 3264 "grammar.c" /* yacc.c:1646  */
  case 100:
#line 1596 "grammar.y" /* yacc.c:1646  */
#line 3278 "grammar.c" /* yacc.c:1646  */
  case 101:
#line 1606 "grammar.y" /* yacc.c:1646  */
#line 3291 "grammar.c" /* yacc.c:1646  */
  case 102:
#line 1615 "grammar.y" /* yacc.c:1646  */
#line 3320 "grammar.c" /* yacc.c:1646  */
  case 103:
#line 1640 "grammar.y" /* yacc.c:1646  */
#line 3336 "grammar.c" /* yacc.c:1646  */
  case 104:
#line 1652 "grammar.y" /* yacc.c:1646  */
#line 3352 "grammar.c" /* yacc.c:1646  */
  case 105:
#line 1664 "grammar.y" /* yacc.c:1646  */
#line 3372 "grammar.c" /* yacc.c:1646  */
  case 106:
#line 1680 "grammar.y" /* yacc.c:1646  */
#line 3388 "grammar.c" /* yacc.c:1646  */
  case 107:
#line 1692 "grammar.y" /* yacc.c:1646  */
#line 3408 "grammar.c" /* yacc.c:1646  */
  case 108:
#line 1708 "grammar.y" /* yacc.c:1646  */
#line 3457 "grammar.c" /* yacc.c:1646  */
  case 109:
#line 1753 "grammar.y" /* yacc.c:1646  */
#line 3480 "grammar.c" /* yacc.c:1646  */
  case 110:
#line 1772 "grammar.y" /* yacc.c:1646  */
#line 3502 "grammar.c" /* yacc.c:1646  */
  case 111:
#line 1790 "grammar.y" /* yacc.c:1646  */
#line 3524 "grammar.c" /* yacc.c:1646  */
  case 112:
#line 1808 "grammar.y" /* yacc.c:1646  */
#line 3546 "grammar.c" /* yacc.c:1646  */
  case 113:
#line 1826 "grammar.y" /* yacc.c:1646  */
#line 3576 "grammar.c" /* yacc.c:1646  */
  case 114:
#line 1852 "grammar.y" /* yacc.c:1646  */
#line 3598 "grammar.c" /* yacc.c:1646  */
  case 115:
#line 1870 "grammar.y" /* yacc.c:1646  */
#line 3612 "grammar.c" /* yacc.c:1646  */
  case 116:
#line 1880 "grammar.y" /* yacc.c:1646  */
#line 3626 "grammar.c" /* yacc.c:1646  */
  case 117:
#line 1890 "grammar.y" /* yacc.c:1646  */
#line 3640 "grammar.c" /* yacc.c:1646  */
  case 118:
#line 1900 "grammar.y" /* yacc.c:1646  */
#line 3654 "grammar.c" /* yacc.c:1646  */
  case 119:
#line 1910 "grammar.y" /* yacc.c:1646  */
#line 3668 "grammar.c" /* yacc.c:1646  */
  case 120:
#line 1920 "grammar.y" /* yacc.c:1646  */
#line 3682 "grammar.c" /* yacc.c:1646  */
  case 121:
#line 1930 "grammar.y" /* yacc.c:1646  */
#line 3690 "grammar.c" /* yacc.c:1646  */
#line 3694 "grammar.c" /* yacc.c:1646  */
#line 1935 "grammar.y" /* yacc.c:1906  */

Fixed code:
#define YYLAST   406
#define YYNRULES  122
#define YYNSTATES  210
     994,  1007,  1018,  1024,  1054,  1023,  1168,  1167,  1246,  1252,
    1259,  1258,  1321,  1320,  1381,  1390,  1399,  1408,  1417,  1426,
    1435,  1439,  1447,  1448,  1453,  1475,  1487,  1503,  1502,  1508,
    1519,  1520,  1525,  1532,  1543,  1544,  1548,  1556,  1560,  1570,
    1584,  1600,  1610,  1619,  1644,  1656,  1668,  1684,  1696,  1712,
    1757,  1776,  1794,  1812,  1830,  1856,  1874,  1884,  1894,  1904,
    1914,  1924,  1934
#define YYTABLE_NINF -95
     -73,    90,   -73,   -32,   -10,   -73,   -73,    93,   -73,   -73,
     -73,   -73,     1,   -73,   -73,   -73,   -73,   -49,     7,   -36,
     -73,    20,    26,   -73,   -28,    92,    46,     4,   -73,    40,
      46,   -73,   100,   119,    16,   -73,    72,   100,   -73,    77,
      83,   -73,   -73,   -73,   -73,   134,    59,   -73,    48,   -73,
     -73,   -73,   133,   136,   -73,   -18,   -73,    88,    95,   -73,
     -73,    91,   -73,   -73,   -73,   -73,   -73,   -73,   102,   -73,
     -73,   126,    48,   126,    48,   -44,   -73,    85,   -73,   127,
     297,   -73,   -73,   126,   110,   126,   126,   126,   126,     2,
     313,   -73,   -73,   -73,    85,   111,   154,   172,   126,    48,
     -73,   -73,    -6,   162,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,    60,    60,   313,   126,   -73,   234,   252,   174,   194,
     -73,   153,    -6,   -73,   -73,   -73,   270,   117,   120,   108,
      48,    48,   -73,   -73,   -73,   -73,   313,   328,   342,   349,
     313,   313,   313,   313,   313,   313,   113,   113,    53,    53,
     -73,   -73,   -73,   -73,   -73,   -73,   -73,   -73,   121,   -73,
     -73,   -73,   -73,   124,   -73,   -73,    48,   151,   -73,    -1,
     126,   125,   -73,   108,   -73,   -73,    18,   -73,   214,   126,
     129,   -73,   143,   -73,    -1,   -73,    63,   121,   -73,    48,
     -73,   -73,   126,   144,    31,   313,    48,   -73,    33,   -73
      29,    38,     0,     0,    45,    59,   104,   106,   108,   101,
     102,     0,   103,    53,    98,    99,    95,    96,     0,    55,
      56,     0,     0,     0,     0,   109,   122,    16,    54,     0,
      80,    39,    39,     0,     0,     0,     0,     0,     0,     0,
      94,   110,    69,   119,     0,    54,    80,     0,     0,    49,
      72,    70,     0,     0,     0,     0,     0,     0,     0,     0,
      62,     0,     0,    81,    97,    46,     0,     0,    50,    51,
       0,     0,    89,    87,    68,    57,    58,   118,   116,   117,
      78,    79,    74,    76,    75,    77,   120,   121,   111,   112,
     113,   114,   115,    42,    41,    43,    44,    40,     0,   105,
     107,   100,    63,     0,    47,    48,     0,    73,    71,     0,
       0,     0,    66,    52,    92,    93,     0,    90,     0,     0,
       0,    83,     0,    88,     0,    84,     0,    85,    64,     0,
      91,    82,     0,     0,     0,    86,     0,    67,     0,    65
     -73,   -73,   211,   212,   -73,   -73,   -73,   -73,   -73,   -73,
     -73,   -73,   -73,   -73,   189,   -73,   183,   -73,   -73,   139,
     -73,   -73,   -73,   -73,   130,   -48,   -72,   -73,   -73,   -73,
     -73,   -73,   -73,    41,   -73,   103,   -73,   -73,    29,   164,
     167,    75,   137,   138,    76,    94,    78,   181,   203,   192,
     141,   140,   190,   125,   196,   144,   179,   186,   187,    79,
      77,    90,    95,   130,    91,     4,    93,    96,    83,    11,
     184,    16,   131,    84,   185,    18,   123,    20,   126,   127,
     128,   129,    97,    98,    92,    99,    22,   139,   142,     8,
      23,   136,    41,    24,   132,    42,    26,   146,   147,   148,
     149,   150,   151,   152,   153,   154,   155,   156,   157,   158,
     159,   160,   161,   162,    43,    44,    29,   168,    54,    55,
      56,    57,    58,   143,    59,    60,    61,    62,    32,    63,
      45,   100,   101,   100,   101,    64,    65,    66,    67,    51,
     -36,    68,   163,   164,   165,   166,    69,    70,   193,   194,
       2,     3,   177,   178,   -17,   -17,   -17,    12,    13,    14,
      27,   207,    71,   209,   183,    34,    72,    73,   118,   119,
     120,    36,    54,   188,    56,    57,    58,    74,    59,    60,
      61,    62,   197,    63,   180,   100,   101,     4,    39,    64,
      65,    66,    67,   201,   202,   205,    54,    46,    56,    57,
      58,    48,    59,    60,    61,    62,    49,    63,   -54,   -54,
      50,   204,    81,    64,    65,    85,    71,    82,   208,   102,
      87,    73,    86,   105,   106,   107,   116,   117,   118,   119,
     120,    88,   114,   115,   116,   117,   118,   119,   120,   124,
      71,   133,   135,    63,   172,    73,   -94,   175,   182,   103,
     104,   176,   101,   198,   189,    88,   105,   106,   107,   108,
     109,   110,   111,   112,   113,   114,   115,   116,   117,   118,
     119,   120,   199,   206,     9,    10,   105,   106,   107,    35,
      47,   122,   191,   200,   134,   114,   115,   116,   117,   118,
     119,   120,    89,   145,     0,   173,   105,   106,   107,     0,
       0,     0,     0,     0,   171,   114,   115,   116,   117,   118,
     119,   120,     0,     0,     0,     0,   105,   106,   107,     0,
       0,     0,     0,     0,   134,   114,   115,   116,   117,   118,
     119,   120,     0,     0,     0,     0,   105,   106,   107,     0,
       0,     0,     0,     0,   195,   114,   115,   116,   117,   118,
     119,   120,     0,     0,   105,   106,   107,     0,     0,     0,
       0,     0,   169,   114,   115,   116,   117,   118,   119,   120,
       0,     0,   105,   106,   107,     0,     0,     0,     0,     0,
     170,   114,   115,   116,   117,   118,   119,   120,     0,   -94,
       0,     0,   103,   104,     0,     0,     0,     0,   174,   105,
     106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
     116,   117,   118,   119,   120,   105,   106,   107,     0,     0,
       0,     0,     0,     0,   114,   115,   116,   117,   118,   119,
     120,   106,   107,     0,     0,     0,     0,     0,     0,   114,
     115,   116,   117,   118,   119,   120,   107,     0,     0,     0,
     114,   115,   116,   117,   118,   119,   120
      48,    68,    74,     1,    71,    37,    73,    74,    26,    19,
      11,    10,    10,    31,    15,    64,    83,    10,    85,    86,
      87,    88,    66,    67,    72,    69,    62,    99,    34,    61,
      10,    98,    16,     7,    32,    19,    64,   104,   105,   106,
     117,   118,   119,   120,    38,    39,    10,   124,    10,    11,
      12,    13,    14,    69,    16,    17,    18,    19,    64,    21,
      54,    40,    41,    40,    41,    27,    28,    29,    30,    20,
      21,    33,    22,    23,    24,    25,    38,    39,    70,    71,
       0,     1,   140,   141,     4,     5,     6,     4,     5,     6,
       8,    70,    54,    70,   176,    65,    58,    59,    55,    56,
      57,    11,    10,   180,    12,    13,    14,    69,    16,    17,
      18,    19,   189,    21,     3,    40,    41,    37,     9,    27,
      28,    29,    30,    70,    71,   202,    10,    65,    12,    13,
      14,    64,    16,    17,    18,    19,    63,    21,    40,    41,
      16,   199,    19,    27,    28,    67,    54,    21,   206,    32,
      69,    59,    67,    42,    43,    44,    53,    54,    55,    56,
      57,    69,    51,    52,    53,    54,    55,    56,    57,    69,
      54,    70,    10,    21,    31,    59,    32,    70,    64,    35,
      36,    71,    41,    64,    69,    69,    42,    43,    44,    45,
      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
      56,    57,    69,    69,     3,     3,    42,    43,    44,    30,
      37,    82,   181,   194,    70,    51,    52,    53,    54,    55,
      56,    57,    68,   103,    -1,   132,    42,    43,    44,    -1,
      -1,    -1,    -1,    -1,    70,    51,    52,    53,    54,    55,
      56,    57,    -1,    -1,    -1,    -1,    42,    43,    44,    -1,
      -1,    -1,    -1,    -1,    70,    51,    52,    53,    54,    55,
      56,    57,    -1,    -1,    -1,    -1,    42,    43,    44,    -1,
      -1,    -1,    -1,    -1,    70,    51,    52,    53,    54,    55,
      56,    57,    -1,    -1,    42,    43,    44,    -1,    -1,    -1,
      -1,    -1,    68,    51,    52,    53,    54,    55,    56,    57,
      -1,    -1,    42,    43,    44,    -1,    -1,    -1,    -1,    -1,
      68,    51,    52,    53,    54,    55,    56,    57,    -1,    32,
      -1,    -1,    35,    36,    -1,    -1,    -1,    -1,    68,    42,
      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
      53,    54,    55,    56,    57,    42,    43,    44,    -1,    -1,
      -1,    -1,    -1,    -1,    51,    52,    53,    54,    55,    56,
      57,    43,    44,    -1,    -1,    -1,    -1,    -1,    -1,    51,
      52,    53,    54,    55,    56,    57,    44,    -1,    -1,    -1,
      51,    52,    53,    54,    55,    56,    57
       1,    10,    32,    70,    70,    10,   112,    94,    95,    98,
     103,   102,    34,    69,   107,    96,   112,   112,   112,   112,
     112,   112,   112,    22,    23,    24,    25,    92,   112,    68,
      68,    70,    31,   107,    68,    70,    71,    97,    97,   108,
       3,    99,    64,    98,    11,    15,   109,   110,   112,    69,
     104,   105,   101,    70,    71,    70,   106,   112,    64,    69,
     110,    70,    71,   100,    97,   112,    69,    70,    97,    70
      98,    98,    98,    99,   100,    98,   101,    98,    98,    98,
     102,    98,   103,    98,    98,    98,    98,    98,    98,    98,
      98,    98,   104,   104,   105,   106,   106,   108,   107,   107,
     109,   109,   110,   110,   111,   111,   111,   112,   112,   112,
     112,   112,   112
       3,     3,     3,     0,     0,    11,     0,     9,     3,     2,
       0,     4,     0,     4,     3,     3,     3,     3,     3,     3,
       1,     3,     3,     1,     5,     1,     3,     0,     4,     1,
       1,     3,     1,     1,     1,     1,     1,     3,     1,     1,
       4,     1,     1,     1,     1,     4,     1,     4,     1,     1,
       2,     3,     3,     3,     3,     3,     3,     3,     3,     2,
       3,     3,     1
    {
        compiler->loop_depth--;
        compiler->loop_identifier[compiler->loop_depth] = NULL;
      }
#line 2594 "grammar.c" /* yacc.c:1646  */
    break;

  case 63:
#line 1024 "grammar.y" /* yacc.c:1646  */
#line 2628 "grammar.c" /* yacc.c:1646  */
  case 64:
#line 1054 "grammar.y" /* yacc.c:1646  */
#line 2667 "grammar.c" /* yacc.c:1646  */
  case 65:
#line 1089 "grammar.y" /* yacc.c:1646  */
#line 2750 "grammar.c" /* yacc.c:1646  */
  case 66:
#line 1168 "grammar.y" /* yacc.c:1646  */
#line 2784 "grammar.c" /* yacc.c:1646  */
  case 67:
#line 1198 "grammar.y" /* yacc.c:1646  */
#line 2837 "grammar.c" /* yacc.c:1646  */
  case 68:
#line 1247 "grammar.y" /* yacc.c:1646  */
#line 2847 "grammar.c" /* yacc.c:1646  */
  case 69:
#line 1253 "grammar.y" /* yacc.c:1646  */
#line 2857 "grammar.c" /* yacc.c:1646  */
  case 70:
#line 1259 "grammar.y" /* yacc.c:1646  */
#line 2887 "grammar.c" /* yacc.c:1646  */
  case 71:
#line 1285 "grammar.y" /* yacc.c:1646  */
#line 2927 "grammar.c" /* yacc.c:1646  */
  case 72:
#line 1321 "grammar.y" /* yacc.c:1646  */
#line 2956 "grammar.c" /* yacc.c:1646  */
  case 73:
#line 1346 "grammar.y" /* yacc.c:1646  */
#line 2996 "grammar.c" /* yacc.c:1646  */
  case 74:
#line 1382 "grammar.y" /* yacc.c:1646  */
#line 3009 "grammar.c" /* yacc.c:1646  */
  case 75:
#line 1391 "grammar.y" /* yacc.c:1646  */
#line 3022 "grammar.c" /* yacc.c:1646  */
  case 76:
#line 1400 "grammar.y" /* yacc.c:1646  */
#line 3035 "grammar.c" /* yacc.c:1646  */
  case 77:
#line 1409 "grammar.y" /* yacc.c:1646  */
#line 3048 "grammar.c" /* yacc.c:1646  */
  case 78:
#line 1418 "grammar.y" /* yacc.c:1646  */
#line 3061 "grammar.c" /* yacc.c:1646  */
  case 79:
#line 1427 "grammar.y" /* yacc.c:1646  */
#line 3074 "grammar.c" /* yacc.c:1646  */
  case 80:
#line 1436 "grammar.y" /* yacc.c:1646  */
#line 3082 "grammar.c" /* yacc.c:1646  */
  case 81:
#line 1440 "grammar.y" /* yacc.c:1646  */
#line 3090 "grammar.c" /* yacc.c:1646  */
  case 82:
#line 1447 "grammar.y" /* yacc.c:1646  */
#line 3096 "grammar.c" /* yacc.c:1646  */
  case 83:
#line 1448 "grammar.y" /* yacc.c:1646  */
#line 3102 "grammar.c" /* yacc.c:1646  */
  case 84:
#line 1454 "grammar.y" /* yacc.c:1646  */
#line 3124 "grammar.c" /* yacc.c:1646  */
  case 85:
#line 1476 "grammar.y" /* yacc.c:1646  */
#line 3140 "grammar.c" /* yacc.c:1646  */
  case 86:
#line 1488 "grammar.y" /* yacc.c:1646  */
#line 3155 "grammar.c" /* yacc.c:1646  */
  case 87:
#line 1503 "grammar.y" /* yacc.c:1646  */
#line 3164 "grammar.c" /* yacc.c:1646  */
  case 89:
#line 1509 "grammar.y" /* yacc.c:1646  */
#line 3175 "grammar.c" /* yacc.c:1646  */
  case 92:
#line 1526 "grammar.y" /* yacc.c:1646  */
#line 3186 "grammar.c" /* yacc.c:1646  */
  case 93:
#line 1533 "grammar.y" /* yacc.c:1646  */
#line 3197 "grammar.c" /* yacc.c:1646  */
  case 95:
#line 1545 "grammar.y" /* yacc.c:1646  */
#line 3205 "grammar.c" /* yacc.c:1646  */
  case 96:
#line 1549 "grammar.y" /* yacc.c:1646  */
#line 3213 "grammar.c" /* yacc.c:1646  */
  case 97:
#line 1557 "grammar.y" /* yacc.c:1646  */
#line 3221 "grammar.c" /* yacc.c:1646  */
  case 98:
#line 1561 "grammar.y" /* yacc.c:1646  */
#line 3235 "grammar.c" /* yacc.c:1646  */
  case 99:
#line 1571 "grammar.y" /* yacc.c:1646  */
#line 3253 "grammar.c" /* yacc.c:1646  */
  case 100:
#line 1585 "grammar.y" /* yacc.c:1646  */
#line 3273 "grammar.c" /* yacc.c:1646  */
  case 101:
#line 1601 "grammar.y" /* yacc.c:1646  */
#line 3287 "grammar.c" /* yacc.c:1646  */
  case 102:
#line 1611 "grammar.y" /* yacc.c:1646  */
#line 3300 "grammar.c" /* yacc.c:1646  */
  case 103:
#line 1620 "grammar.y" /* yacc.c:1646  */
#line 3329 "grammar.c" /* yacc.c:1646  */
  case 104:
#line 1645 "grammar.y" /* yacc.c:1646  */
#line 3345 "grammar.c" /* yacc.c:1646  */
  case 105:
#line 1657 "grammar.y" /* yacc.c:1646  */
#line 3361 "grammar.c" /* yacc.c:1646  */
  case 106:
#line 1669 "grammar.y" /* yacc.c:1646  */
#line 3381 "grammar.c" /* yacc.c:1646  */
  case 107:
#line 1685 "grammar.y" /* yacc.c:1646  */
#line 3397 "grammar.c" /* yacc.c:1646  */
  case 108:
#line 1697 "grammar.y" /* yacc.c:1646  */
#line 3417 "grammar.c" /* yacc.c:1646  */
  case 109:
#line 1713 "grammar.y" /* yacc.c:1646  */
#line 3466 "grammar.c" /* yacc.c:1646  */
  case 110:
#line 1758 "grammar.y" /* yacc.c:1646  */
#line 3489 "grammar.c" /* yacc.c:1646  */
  case 111:
#line 1777 "grammar.y" /* yacc.c:1646  */
#line 3511 "grammar.c" /* yacc.c:1646  */
  case 112:
#line 1795 "grammar.y" /* yacc.c:1646  */
#line 3533 "grammar.c" /* yacc.c:1646  */
  case 113:
#line 1813 "grammar.y" /* yacc.c:1646  */
#line 3555 "grammar.c" /* yacc.c:1646  */
  case 114:
#line 1831 "grammar.y" /* yacc.c:1646  */
#line 3585 "grammar.c" /* yacc.c:1646  */
  case 115:
#line 1857 "grammar.y" /* yacc.c:1646  */
#line 3607 "grammar.c" /* yacc.c:1646  */
  case 116:
#line 1875 "grammar.y" /* yacc.c:1646  */
#line 3621 "grammar.c" /* yacc.c:1646  */
  case 117:
#line 1885 "grammar.y" /* yacc.c:1646  */
#line 3635 "grammar.c" /* yacc.c:1646  */
  case 118:
#line 1895 "grammar.y" /* yacc.c:1646  */
#line 3649 "grammar.c" /* yacc.c:1646  */
  case 119:
#line 1905 "grammar.y" /* yacc.c:1646  */
#line 3663 "grammar.c" /* yacc.c:1646  */
  case 120:
#line 1915 "grammar.y" /* yacc.c:1646  */
#line 3677 "grammar.c" /* yacc.c:1646  */
  case 121:
#line 1925 "grammar.y" /* yacc.c:1646  */
#line 3691 "grammar.c" /* yacc.c:1646  */
  case 122:
#line 1935 "grammar.y" /* yacc.c:1646  */
#line 3699 "grammar.c" /* yacc.c:1646  */
#line 3703 "grammar.c" /* yacc.c:1646  */
#line 1940 "grammar.y" /* yacc.c:1906  */
    | _FOR_ for_expression error
      {
        compiler->loop_depth--;
        compiler->loop_identifier[compiler->loop_depth] = NULL;
      }