Ignore:
Timestamp:
Nov 24, 2002, 7:02:36 AM (23 years ago)
Author:
mjs
Message:
  • fixed 3098356 - Hard hang on movie search at www.movietickets.com
  • kjs/string_object.cpp: (StringProtoFuncImp::call): When doing a regexp replacement that results in an empty match, always move on to the next character after doing the replacement. The previous code would hit an infinite loop if an initial empty match was replaced with the empty string.
File:
1 edited

Legend:

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

    r2783 r2849  
    299299          break;
    300300        len = mstr.size();
    301         // special case of empty match
    302         if (len == 0 && lastIndex > 0) {
    303           pos = lastIndex + 1;
    304           if (pos > u.size())
    305             break;
    306         }
    307301        UString rstr(u3);
    308302        bool ok;
     
    326320        u = u.substr(0, pos) + rstr + u.substr(pos + len);
    327321        //fprintf(stderr,"pos=%d,len=%d,lastIndex=%d,u=%s\n",pos,len,lastIndex,u.ascii());
     322
     323        // special case of empty match
     324        if (len == 0) {
     325          lastIndex = lastIndex + 1;
     326          if (lastIndex > u.size())
     327            break;
     328        }
    328329      } while (global);
    329330
Note: See TracChangeset for help on using the changeset viewer.