Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a7e9939e719b733482aeeaa40c5176869a5fdee9
Ticket: 2960021fffffffffffffffffffffffffffffffff
"string first" command on large string segfaults
User & Date: blacksqr on 2010-02-27 06:47:17
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    When the "needleString" argument to a "string first" command is very large, a segmentation fault will result.
    
    It is easy to switch the "needleString" and the "haystackString" by mistake in the "string first" command, and thus encounter this bug.  Mistake notwithstanding, the command is still syntactically correct, and one should expect a "-1" as a return value.
    
    To replicate, simply execute the following procedure:
    
    proc string_first_bug {} {
    set line xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    for {set i 0} {$i < 1048547} {incr i} {
    append largeString $line\n
    }
    set line_ [string first $largeString \n]
    }
    
    ActiveTcl 8.5.8 on Ubuntu Intrepid.
    
  4. foundin changed to: "obsolete: 8.5.8"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "blacksqr"
  10. subsystem changed to: "18. Commands M-Z"
  11. title changed to: ""string first" command on large string segfaults"
  12. type changed to: "Bug"