Changeset 5565 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Nov 17, 2003, 9:40:43 PM (22 years ago)
Author:
mjs
Message:

Patch from Harri, reviewed by me.

  • fixed 3487375 - backwards array slice causes infinite loop
  • kjs/array_object.cpp: (ArrayProtoFuncImp::call):
Location:
trunk/JavaScriptCore/kjs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/array_object.cpp

    r5436 r5565  
    579579    Object resObj = Object::dynamicCast(exec->interpreter()->builtinArray().construct(exec,List::empty()));
    580580    result = resObj;
    581     int begin = args[0].toUInt32(exec);
     581    int begin = args[0].toInteger(exec);
    582582    if ( begin < 0 )
    583583      begin = maxInt( begin + length, 0 );
     
    587587    if (args[1].type() != UndefinedType)
    588588    {
    589       end = args[1].toUInt32(exec);
     589      end = args[1].toInteger(exec);
    590590      if ( end < 0 )
    591591        end = maxInt( end + length, 0 );
     
    595595
    596596    //printf( "Slicing from %d to %d \n", begin, end );
    597     for(unsigned int k = 0; k < (unsigned int) end-begin; k++) {
    598       if (thisObj.hasProperty(exec,k+begin)) {
    599         Value obj = thisObj.get(exec, k+begin);
    600         resObj.put(exec, k, obj);
    601       }
    602     }
    603     resObj.put(exec, lengthPropertyName, Number(end - begin), DontEnum | DontDelete);
     597    int n = 0;
     598    for(int k = begin; k < end; k++, n++) {
     599      if (thisObj.hasProperty(exec, k)) {
     600        Value obj = thisObj.get(exec, k);
     601        resObj.put(exec, n, obj);
     602      }
     603    }
     604    resObj.put(exec, lengthPropertyName, Number(n), DontEnum | DontDelete);
    604605    break;
    605606  }
  • trunk/JavaScriptCore/kjs/grammar.cpp

    r5356 r5565  
    275275     0,   105,    34,   104,     0,   105,    35,   104,     0,   105,
    276276    36,   104,     0,   105,    37,   104,     0,   105,     0,   106,
    277     79,   105,     0,   106,     0,   107,    80,   105,     0,   107,
    278      0,   108,    81,   105,     0,   108,     0,   109,    41,   108,
     277    79,   105,     0,   106,     0,   107,    80,   106,     0,   107,
     278     0,   108,    81,   107,     0,   108,     0,   109,    41,   108,
    279279     0,   109,     0,   110,    40,   109,     0,   110,     0,   110,
    280280    82,   112,    69,   112,     0,   111,     0,    98,   113,   112,
     
    476476-32768,-32768,-32768,-32768,-32768,-32768,-32768,   779,-32768,-32768,
    477477     7,-32768,   964,   161,-32768,    45,    42,-32768,   136,    17,
    478 -32768,-32768,     8,-32768,   192,    24,-32768,-32768,    18,    90,
     478-32768,-32768,     8,-32768,   198,    24,-32768,-32768,    18,    90,
    479479-32768,-32768,  1252,   236,  1252,-32768,  1252,  1252,   -45,   483,
    480    231,-32768,-32768,   853,-32768,-32768,    59,   191,   196,   -21,
    481    935,   123,   208,   557,-32768,   200,  1036,   203,-32768,-32768,
    482 -32768,-32768,  1108,  1252,   222,-32768,  1252,   224,-32768,-32768,
     480   219,-32768,-32768,   853,-32768,-32768,    59,   202,   204,   -21,
     481   935,   123,   205,   557,-32768,   186,  1036,   197,-32768,-32768,
     482-32768,-32768,  1108,  1252,   217,-32768,  1252,   218,-32768,-32768,
    483483-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    484484-32768,-32768,-32768,  1252,  1252,  1252,  1252,  1252,  1252,  1252,
    485485  1252,  1252,  1252,  1252,  1252,  1252,  1252,  1252,  1252,  1252,
    486486  1252,  1252,  1252,  1252,  1252,  1252,  1252,  1252,-32768,  1252,
    487 -32768,-32768,-32768,-32768,   226,    87,   217,   204,-32768,-32768,
     487-32768,-32768,-32768,-32768,   222,    87,   209,   203,-32768,-32768,
    488488-32768,-32768,-32768,  1252,-32768,-32768,   -30,-32768,-32768,-32768,
    489    105,-32768,   223,   103,-32768,-32768,   113,   227,   115,   116,
    490    117,-32768,-32768,   228,   -20,   253,-32768,-32768,-32768,-32768,
     489   105,-32768,   220,   103,-32768,-32768,   113,   223,   115,   116,
     490   117,-32768,-32768,   224,   -20,   249,-32768,-32768,-32768,-32768,
    491491    35,  1252,-32768,-32768,    -1,-32768,-32768,-32768,-32768,   119,
    492 -32768,   202,-32768,   206,-32768,-32768,-32768,-32768,-32768,   -14,
     492-32768,   196,-32768,   200,-32768,-32768,-32768,-32768,-32768,   -14,
    493493   -14,    12,    12,    12,   195,   195,   195,   195,   195,   195,
    494     82,    82,    82,    82,   118,   118,   118,    93,   151,   225,
    495 -32768,    -3,   -44,  1252,  1252,-32768,-32768,   223,   126,   631,
    496 -32768,   223,   233,   853,  1252,   853,   229,   853,   234,-32768,
    497 -32768,   232,-32768,  1180,-32768,  1252,-32768,-32768,  1252,  1252,
    498    271,  1252,   127,   212,-32768,   223,-32768,   705,-32768,-32768,
    499    274,   157,-32768,   289,-32768,-32768,   237,  1252,-32768,-32768,
    500 -32768,-32768,   174,  1252,   218,   853,  1252,-32768,-32768,   853,
    501 -32768,  1252,    23,   289,-32768,   -20,-32768,   853,   175,  1252,
    502 -32768,   243,-32768,   207,   238,-32768,   289,-32768,-32768,-32768,
    503    853,   246,   853,   853,   853,   245,-32768,   853,-32768,-32768,
    504    853,   853,-32768,-32768,-32768,   312,   314,-32768
     494    82,    82,    82,    82,   118,    72,    85,    93,   151,   221,
     495-32768,    -3,   -44,  1252,  1252,-32768,-32768,   220,   126,   631,
     496-32768,   220,   230,   853,  1252,   853,   225,   853,   233,-32768,
     497-32768,   226,-32768,  1180,-32768,  1252,-32768,-32768,  1252,  1252,
     498   268,  1252,   127,   210,-32768,   220,-32768,   705,-32768,-32768,
     499   270,   157,-32768,   287,-32768,-32768,   234,  1252,-32768,-32768,
     500-32768,-32768,   174,  1252,   214,   853,  1252,-32768,-32768,   853,
     501-32768,  1252,    23,   287,-32768,   -20,-32768,   853,   175,  1252,
     502-32768,   237,-32768,   201,   232,-32768,   287,-32768,-32768,-32768,
     503   853,   239,   853,   853,   853,   241,-32768,   853,-32768,-32768,
     504   853,   853,-32768,-32768,-32768,   307,   309,-32768
    505505};
    506506
    507507static const short yypgoto[] = {-32768,
    508 -32768,-32768,-32768,    91,-32768,-32768,    94,   309,   310,-32768,
    509    -34,-32768,    41,-32768,     1,   120,    88,   -18,    75,    78,
    510 -32768,-32768,   143,   145,-32768,-32768,  -122,-32768,    -9,   -17,
     508-32768,-32768,-32768,    89,-32768,-32768,    91,   302,   308,-32768,
     509   -34,-32768,    41,-32768,     1,   120,    88,   -18,    75,   142,
     510   143,   144,   146,   141,-32768,-32768,  -122,-32768,    -9,   -17,
    511511   -22,   -25,-32768,   138,   128,    67,-32768,-32768,-32768,-32768,
    512512  -249,-32768,-32768,-32768,-32768,-32768,-32768,    -7,-32768,    13,
     
    545545   147,   148,   149,   150,   151,   152,   328,   341,   160,   161,
    546546   162,   180,   180,   251,   252,   253,   254,   242,   243,   244,
    547    255,   256,   257,   201,   293,   187,   301,   208,   303,   -27,
    548    306,   153,   214,   215,   -28,   302,   224,   225,   287,   180,
    549    228,   298,   288,   180,   180,   344,   222,   240,   241,   233,
    550    313,   235,   187,   262,   180,   215,   270,   265,   275,   279,
    551    300,   307,   304,   289,   314,   317,   320,   322,   331,   326,
    552    308,   330,   333,   339,   329,   343,   345,   187,   348,   353,
    553    340,   357,   334,   358,   282,   284,    87,    88,   258,   352,
    554    187,   259,   263,   347,   267,   349,   350,   350,   291,   346,
     547   214,   215,   224,   225,   293,   187,   301,   208,   303,   201,
     548   306,   153,   287,   180,   228,   302,   288,   180,   180,   344,
     549   -27,   298,   -28,   222,   233,   235,   180,   240,   241,   262,
     550   313,   215,   187,   270,   275,   279,   265,   300,   304,   289,
     551   307,   314,   320,   317,   308,   322,   326,   330,   331,   343,
     552   345,   348,   333,   339,   329,   353,   357,   187,   358,    87,
     553   340,   282,   334,   284,   255,    88,   256,   259,   257,   352,
     554   187,   258,   263,   347,   267,   349,   350,   350,   291,   346,
    555555   354,   269,     0,   355,   355,    97,   338,     1,     2,     3,
    556556     4,     5,     0,     0,   281,     0,     8,     0,     0,    84,
     
    681681    52,    53,    54,    55,    56,    57,    63,    63,    44,    45,
    682682    46,    68,    68,   169,   170,   171,   172,   160,   161,   162,
    683    173,   174,   175,    62,   264,   265,   274,    22,   276,    69,
    684    278,    83,    32,    33,    69,   275,    67,    68,    67,    68,
    685     68,   270,    67,    68,    68,    69,    69,   158,   159,    58,
    686    290,    58,   292,    58,    68,    33,    64,    84,    62,    62,
    687     58,    58,    64,    69,    24,    84,    23,     9,   316,    63,
    688     69,    84,   320,   326,   314,    63,    69,   317,    63,    65,
    689    328,     0,   322,     0,   221,   225,     8,     8,   176,   345,
    690    330,   177,   185,   341,   197,   343,   344,   345,   262,   337,
     683    32,    33,    67,    68,   264,   265,   274,    22,   276,    62,
     684   278,    83,    67,    68,    68,   275,    67,    68,    68,    69,
     685    69,   270,    69,    69,    58,    58,    68,   158,   159,    58,
     686   290,    33,   292,    64,    62,    62,    84,    58,    64,    69,
     687    58,    24,    23,    84,    69,     9,    63,    84,   316,    63,
     688    69,    63,   320,   326,   314,    65,     0,   317,     0,     8,
     689   328,   221,   322,   225,   173,     8,   174,   177,   175,   345,
     690   330,   176,   185,   341,   197,   343,   344,   345,   262,   337,
    691691   348,   201,    -1,   351,   352,     1,   324,     3,     4,     5,
    692692     6,     7,    -1,    -1,   216,    -1,    12,    -1,    -1,    15,
Note: See TracChangeset for help on using the changeset viewer.