Skip to content
Tcl Source Code History Of Ticket 219073
Login

History Of Ticket 219073

Artifacts Associated With Ticket 219073

  1. Ticket change [ecd56ab4d3] (rid 103775) by nobody on 2000-10-26 01:10:19:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 4981 Bug
      Version: 8.3
      SubmitDate: '2000-04-10'
      LastModified: '2000-04-10'
      Severity: CRIT
      Status: Released
      Submitter: ericm
      ChangedBy: ericm
      OS: All
      FixedDate: '2000-04-10'
      FixedInVersion: 8.3.1
      ClosedDate: '2000-10-25'
      
      
      Because of the implementation of regexp -all, this command:
      
      regexp -all {a*} a
      
      will loop indefinately.  The problem is traced to the regexp command, in which the following (essentially) occurs:
      
      while (1) {
      matchRegexp(...offset...);
      
      ...
      
      offset += matchLength;
      }
      
      In the case of {a*} and the string a, the regexp will match the {} at the end of the string.  Of course, the length of {} is 0, so the offset never gets incremented, so the next pass through the loop matches against the same chunk of the string.  And so on, ad infinitum.
      
      The fix requires two changes:
      
      1.  offset should always be incremented by min(1, matchLength)
      2.  after offset has been incremented, it should be tested to see if it is past the end of the string; if so, the loop should terminate.  the regexp matching engine has the invarient that starting indices past the end of the string get confined to the range of the string, so specifying an offset of stringLength+1 will not cause it to fail to match -- it will just interpret that as stringLength.
      
      - eric
      
      
      
      Fixed for 8.3.1., with tests.
      
      - eric
      
      
    4. foundin initialized to: "obsolete: 8.3"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "43. Regexp"
    10. title initialized to: "[regexp -all {a*} a] loops infinitely"
    11. type initialized to: "Bug"
  2. Ticket change [418d7e08c9] (rid 116210) by welch on 2000-10-26 08:34:07:

    1. closedate changed to: "2000-10-26T01:34:07"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"