Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7f8ce56d41d9f25193c84e5ffaa6e8cacd99d875
Ticket: 32ae34e63a3db0a542a6795594914baa1f231007
[chan copy] reflected channel segfault
User & Date: dgp on 2015-08-11 20:46:57
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    This script segfaults:
    
        proc driver {cmd args} {
            variable buffer
            variable index
            set chan [lindex $args 0]
            switch -- $cmd {
                initialize {
                    set index($chan) 0
                    set buffer($chan) [encoding convertto utf-8 \
                            [string repeat a 100]]
                    return {initialize finalize watch read}
                }
                finalize {
                    unset index($chan) buffer($chan)
                    return
                }
                watch {
    		if {"read" in [lindex $args 1]} {
    		    chan postevent $chan read
    		}
    		return
                }
                read {
                    set n [lindex $args 1]
                    set new [expr {$index($chan) + $n}]
                    set result [string range $buffer($chan) $index($chan) $new-1]
                    set index($chan) $new
                    return $result
                }
            }
        }
        proc noop args {}
        proc more {c outChan bytes args} {
            if {[eof $c]} {
                set ::done eof
                catch {close $c}
                return
            }
            if {[llength $args]} {
                set ::done error
            } else  {
                chan copy $c $outChan -command noop
            }
        }
        set c [chan create read [namespace which driver]]
        chan configure $c -encoding utf-8
        set outChan [open out w]
        chan configure $outChan -encoding iso8859-1
        after 100 {set ::done timeout}
        chan copy $c $outChan -size 99 -command [list [namespace which more] $c $outChan]
        vwait ::done
        puts $::done
        close $outChan
        file delete out
        rename driver {}
        rename more {}
        unset ::done
    
  5. foundin changed to: "all"
  6. is_private changed to: "0"
  7. login: "dgp"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "dgp"
  13. subsystem changed to: "25. Channel System"
  14. title changed to: "[chan copy] reflected channel segfault"
  15. type changed to: "Bug"