Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b1ffedfb1907a5f49f373463540058a973c9585f
Ticket: 3513146fffffffffffffffffffffffffffffffff
string index permits invalid charIndex
User & Date: dkf on 2012-03-30 15:59:26
Changes

  1. closedate changed to: "2012-03-30T08:59:26"
  2. closer changed to: "dkf"
  3. icomment:
    
    
    allow_comments - 1
    
    The [string index] runs to the first balanced bracket. The second is just an ordinary character. Tcl concatenates strings by default. Here's the proof: a disassembly of that command:
    
    % tcl::unsupported::disassemble script {set val [string index $x end]]}
    ByteCode 0x0x4dd10, refCt 1, epoch 3, interp 0x0x31c10 (epoch 3)
      Source "set val [string index $x end]]"
      Cmds 2, src 30, inst 23, litObjs 4, aux 0, stkDepth 3, code/src 0.00
      Commands 2:
          1: pc 0-21, src 0-29      2: pc 2-16, src 9-27
      Command 1: "set val [string index $x end]]"
        (0) push1 0 # "val"
      Command 2: "string index $x end"
        (2) startCommand +15 1 # next cmd at pc 17
        (11) push1 1 # "x"
        (13) loadScalarStk 
        (14) push1 2 # "end"
        (16) strindex 
        (17) push1 3 # "]"
        (19) concat1 2 
        (21) storeScalarStk 
        (22) done 
    
    
    
  4. login: "dkf"
  5. mimetype: "text/plain"
  6. resolution changed to: "Invalid"
  7. status changed to: "Closed"
  8. username: "dkf"