Changeset 2304 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 10, 2002, 9:07:07 PM (23 years ago)
Author:
darin
Message:
  • fixed 3072643 -- infinite loop in JavaScript code at walgreens.com

The problem is that "xxx".indexOf("", 1) needs to return 1, but we
were returning 0.

  • kjs/ustring.cpp: (UString::find): Return pos, not 0, when the search string is empty. (UString::rfind): Make sure that pos is not past the end of the string, taking into account the search string; fixes a potential read off the end of the buffer. Also return pos, not 0, when the search string is empty.
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r2299 r2304  
     12002-10-10  Darin Adler  <[email protected]>
     2
     3        - fixed 3072643 -- infinite loop in JavaScript code at walgreens.com
     4
     5        The problem is that "xxx".indexOf("", 1) needs to return 1, but we
     6        were returning 0.
     7
     8        * kjs/ustring.cpp:
     9        (UString::find): Return pos, not 0, when the search string is empty.
     10        (UString::rfind): Make sure that pos is not past the end of the string,
     11        taking into account the search string; fixes a potential read off the end
     12        of the buffer. Also return pos, not 0, when the search string is empty.
     13
    114=== Alexander-27 ===
    215
  • trunk/JavaScriptCore/ChangeLog-2002-12-03

    r2299 r2304  
     12002-10-10  Darin Adler  <[email protected]>
     2
     3        - fixed 3072643 -- infinite loop in JavaScript code at walgreens.com
     4
     5        The problem is that "xxx".indexOf("", 1) needs to return 1, but we
     6        were returning 0.
     7
     8        * kjs/ustring.cpp:
     9        (UString::find): Return pos, not 0, when the search string is empty.
     10        (UString::rfind): Make sure that pos is not past the end of the string,
     11        taking into account the search string; fixes a potential read off the end
     12        of the buffer. Also return pos, not 0, when the search string is empty.
     13
    114=== Alexander-27 ===
    215
  • trunk/JavaScriptCore/ChangeLog-2003-10-25

    r2299 r2304  
     12002-10-10  Darin Adler  <[email protected]>
     2
     3        - fixed 3072643 -- infinite loop in JavaScript code at walgreens.com
     4
     5        The problem is that "xxx".indexOf("", 1) needs to return 1, but we
     6        were returning 0.
     7
     8        * kjs/ustring.cpp:
     9        (UString::find): Return pos, not 0, when the search string is empty.
     10        (UString::rfind): Make sure that pos is not past the end of the string,
     11        taking into account the search string; fixes a potential read off the end
     12        of the buffer. Also return pos, not 0, when the search string is empty.
     13
    114=== Alexander-27 ===
    215
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r1887 r2304  
    492492  if (sz < fsz)
    493493    return -1;
    494   if (fsz == 0)
    495     return 0;
    496494  if (pos < 0)
    497495    pos = 0;
     496  if (fsz == 0)
     497    return pos;
    498498  const UChar *end = data() + sz - fsz;
    499499  long fsizeminusone = (fsz - 1) * sizeof(UChar);
     
    524524  if (sz < fsz)
    525525    return -1;
    526   if (fsz == 0)
    527     return 0;
    528526  if (pos < 0)
    529527    pos = 0;
     528  if (pos > sz - fsz)
     529    pos = sz - fsz;
     530  if (fsz == 0)
     531    return pos;
    530532  long fsizeminusone = (fsz - 1) * sizeof(UChar);
    531533  const UChar *fdata = f.data();
Note: See TracChangeset for help on using the changeset viewer.