Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 681c1906bd20fdf80ea7577ef1594246e74be669
Ticket: 3106532fffffffffffffffffffffffffffffffff
"switch -regexp -indexvar" gives invalid range
User & Date: martinlemburg on 2010-11-10 23:46:33
Changes

  1. icomment:
    In tclCmdMZ.c:
    line 276+277 (Tcl_RegexpObjCmd):
    match = Tcl_RegExpExecObj(interp, regExpr, objPtr, offset, numMatchesSaved, eflags);
    
    line 3740+3741 (Tcl_SwitchObjCmd):
    int matched = Tcl_RegExpExecObj(interp, regExpr, stringObj, 0, numMatchesSaved, 0);
    
    The first call to Tcl_RegExpExecObj has an "offset", that later on in ...
    
    line 341-343:
        if (end >= offset) {
    end--;
        }
     
    ... is used to correct the "end" index to point to the last character of the match.
    
    This is missing in Tcl_SwitchObjCmd!
    
    Since my time is limited I was not yet able to think about the offset ... :(
    
    
  2. login: "martinlemburg"
  3. mimetype: "text/plain"
  4. username: "martinlemburg"