1 # These regression tests all provoked crashes at some point.
2 # Thus they are kept separate from the regular test suite in tests/
5 # 27Jan2005 - SIGSEGV for bug on Jim_DuplicateObj().
7 for {set i
0} {$i < 100} {incr i
} {
14 # 29Jan2005 - SEGFAULT parsing script composed of just one comment.
19 # 29Jan2005 - "Error in Expression" with correct expression
25 # 29Jan2005 - SIGSEGV when run this code, due to expr's bug.
30 expr {[fibonacci
[expr {$x-1}]] + [fibonacci
[expr {$x-2}]]}
37 # 06Mar2005 - This looped forever...
38 for {set i
0} {$i < 10} {incr i
} {continue}
42 # 07Mar2005 - Unset create variable + dict is using dict syntax sugar at
43 # currently non-existing variable
44 catch {unset thisvardoesnotexists
(thiskeytoo
)}
45 if {[catch {set thisvardoesnotexists
}] == 0} {
46 puts "TEST 6 FAILED - unset created dict for non-existing variable"
52 # 04Nov2008 - variable parsing does not eat last brace
58 # 04Nov2008 - string toupper/tolower do not convert to string rep
59 string tolower
[list a
]
60 string toupper
[list a
]
64 # 04Nov2008 - crash on exit when replacing Tcl proc with C command.
65 # Requires the clock extension to be built as a loadable module.
67 catch {package require
clock}
68 # Note, crash on exit, so don't say we passed!
71 # 05Nov2008 - incorrect lazy expression evaluation with unary not
76 # 14 Feb 2010 - access static variable in deleted proc
77 proc a
{} {{x
1}} { rename a
""; incr x
}
82 # 13 Sep 2010 - reference with invalid tag
83 set a b
[ref value
"tag name"]
84 getref
[string range
$a 1 end
]
88 # 14 Sep 2010 - parse list with trailing backslash
89 set x
"switch -0 \$on \\"
94 # 14 Sep 2010 - command expands to nothing
99 # 24 Feb 2010 - bad reference counting of the stack trace in 'error'
101 tailcall
error $msg $stack
103 catch {fail
} msg opts
104 catch {a
$msg $opts(-errorinfo)}
107 # 24 Feb 2010 - rename the current proc
108 # Leaves unfreed objects on the stack
109 proc a
{} { rename a newa
}
113 # 26 Nov 2010 - crashes on invalid dict sugar
115 puts "TEST 17 PASSED"
118 # 12 Apr 2011 - crashes on unset for loop var
121 for {set i
0} {$i < 5} {incr i
} {
128 puts "TEST 18 PASSED"
131 # 25 May 2011 - crashes with double colon
135 puts "TEST 19 PASSED"
138 # 26 May 2011 - infinite recursion
139 proc a
{} { global ::blah; set ::blah test
}
141 puts "TEST 20 PASSED"
144 # 26 May 2011 - infinite loop with null byte in subst
146 puts "TEST 21 PASSED"
149 # 21 June 2011 - crashes on lappend to to value with script rep
153 puts "TEST 22 PASSED"
156 # 27 July 2011 - unfreed objects on exit
162 # Actually, the test passes if no objects leaked on exit
163 puts "TEST 23 PASSED"
166 # 13 Nov 2011 - invalid cached global var
175 puts "TEST 24 PASSED"
178 # 14 Nov 2011 - link global var to proc var
188 puts "TEST 25 PASSED"
191 # 2 Dec 2011 - infinite eval recursion
194 set y
{incr x
; eval $y}
197 puts "TEST 26 PASSED"
200 # 2 Dec 2011 - infinite alias recursion
206 puts "TEST 27 PASSED"
209 # 16 Dec 2011 - ref count problem with finalizers
214 puts "TEST 28 PASSED"
217 # Reference counting problem at exit
221 puts "TEST 29 PASSED"
224 # non-UTF8 string tolower
225 string tolower
"/mod/video/h\303\203\302\244xan_ witchcraft through the ages_20131101_0110.t"
226 puts "TEST 30 PASSED"
229 # infinite lsort -unique with error
230 catch {lsort -unique -real {foo
42.0}}
231 puts "TEST 31 PASSED"
234 # return -code eval should only used by tailcall, but this incorrect usage
235 # should not crash the interpreter
236 proc a
{} { tailcall b
}
237 proc b
{} { return -code eval c
}
240 puts "TEST 32 PASSED"
243 # unset array variable which doesn't exist
244 array unset blahblah abc
245 puts "TEST 33 PASSED"
248 # onexception and writable conflict
249 set f
[open [info nameofexecutable
]]
250 $f onexception
{incr x
}
253 puts "TEST 34 PASSED"
256 # caching of command resolution after local proc deleted
265 foreach i
{1 2 3 4} {
268 puts "TEST 35 PASSED"
271 # divide integer by integer zero
273 puts "TEST 36 PASSED"
276 # ternary operator order
277 catch {expr {1 : 2 ?
3}}
278 puts "TEST 37 PASSED"
281 # refcount with interpolation and expr
284 puts "TEST 38 PASSED"
287 # invalid ternary expr
288 catch {set a
$(5?
6,7?
8:?
9:10%11:12)}
289 puts "TEST 39 PASSED"
292 # ref count problem - double free
293 set d
[dict create a b
]
295 catch {dict remove r
($d) m
}
296 puts "TEST 40 PASSED"
299 # access invalid memory on no scan conversion char
301 puts "TEST 41 PASSED"
304 # | and |& are not acceptable as prefixes
305 catch {exec dummy |x second
}
306 puts "TEST 42 PASSED"
309 # too many flags to format
310 catch {format %----------------------------------------d 1}
311 puts "TEST 43 PASSED"
314 # lsort -unique with no duplicate - invalid memory write
315 lsort -unique {a b c d
}
316 puts "TEST 44 PASSED"
319 # regexp with missing close brace for count
320 catch [list regexp "u{0" x
]
321 puts "TEST 45 PASSED"
324 # scan with no stringrep
325 catch {scan $(1) $(1)}
326 puts "TEST 46 PASSED"
329 # Invalid ternary expression
330 catch {set a
$(99?
9,99?
9:*9:999)?
9)}
331 puts "TEST 47 PASSED"
334 # scan: -ve XPG3 specifier
335 catch {scan a
{%-9999999$c}}
336 puts "TEST 48 PASSED"
339 # format: precision too large
340 catch {format %1.9999999999f
1.0}
341 puts "TEST 49 PASSED"
344 # expr missing operand
346 puts "TEST 50 PASSED"
349 # expr convert invalid value to boolean
350 catch {expr {2 && "abc$"}}
351 puts "TEST 51 PASSED"
354 # lsearch -command with too few args
355 catch {lsearch -all -command abc def
}
356 puts "TEST 52 PASSED"
359 # string last with invalid index
360 catch {string last foo bar
-1}
361 puts "TEST 53 PASSED"
364 # TAKE THE FOLLOWING puts AS LAST LINE
366 puts "--- ALL TESTS PASSED ---"