Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2010-11-17
08:20 • Closed ticket [3098302fff]: Bytecode for catch causes crash plus 2 other c... artifact: ebbb208cc9 user: sf-robot
08:20 • Ticket [3098302fff]: 4 changes artifact: ff10735eeb user: sf-robot
2010-11-03
08:13 • Pending ticket [3098302fff]. artifact: c7ed0f0a0d user: kennykb
03:09 • Ticket [3098302fff]: 4 changes artifact: 171800dd29 user: dkf
2010-10-31
01:14 • Ticket [3098302fff]: 4 changes artifact: 59706401d0 user: kennykb
01:14 • Add attachment catch.patch to ticket [3098302fff] artifact: 5b558cb587 user: kennykb
01:14 • Ticket [3098302fff] Bytecode for catch causes crash status still Open with... artifact: 9389c6926c user: kennykb
00:10 • Ticket [3098302fff]: 4 changes artifact: 7815688acb user: kennykb
2010-10-30
00:51 • Ticket [3098302fff]: 4 changes artifact: ef651129a0 user: kennykb
00:51 • Add attachment bytecodeDump.txt to ticket [3098302fff] artifact: a3811e6dd8 user: kennykb
00:51 • Ticket [3098302fff] Bytecode for catch causes crash status still Open with... artifact: cd126b9629 user: kennykb
00:51 • Add attachment Bytecode safety and exception ranges..txt to ticket [309... artifact: 2d32d53d89 user: kennykb
2010-10-29
15:29 • New ticket [3098302fff] Bytecode for catch causes crash. artifact: fbd1248dcc user: kennykb

Bytecode for [catch] causes crash

Closed / Fixed3098302fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2010-10-29 15:29:43
If a [catch {some script} result] or [catch {some script} result options] has a write trace fail on the 'result' or 'options' variables, the 'endCatch' bytecode for the catch block gets bypassed, and the exception stack becomes unbalanced. The result is somewhat unpredictable, but likely to be unamusing:

Test case:

proc failtrace {n1 n2 op} {
    return -code error "trace on $n1 fails by request"
}
trace add variable result1 write failtrace

proc x {} {
    variable result1
    for {set i 0} {$i < 100} {incr i} {
set status2 [catch {
    set status1 [catch {
return -code error -level 0 "original failure"
    } result1 options1]
} result2 options2]
lappend retval $status2 $result2 $options2
    }
}

puts [x]

Test result:

Bad stack top 7 at pc 144 in TclNRExecuteByteCode (min 0, max 6)
 executing lappend retval $status2 $result2 $options2
TclNRExecuteByteCode execution failure: bad stack top

Will follow up on tcl-core.
kennykbplain2010-10-30 00:51:16
File Added - 391664: Bytecode safety and exception ranges..txt
kennykbplain2010-10-30 00:51:53
File Added - 391665: bytecodeDump.txt
kennykbplain2010-10-31 00:10:49
File Added - 391729: catch.patch
kennykbplain2010-10-31 01:14:18
File Deleted - 391729:
kennykbplain2010-10-31 01:14:56
File Added - 391732: catch.patch
dkfplain2010-11-03 03:09:58
I *think* the patch is correct.
kennykbplain2010-11-03 08:13:03
dkf's blessing is good enough for me. committed the patch and backported onto core-8-5-branch. Leaving this one 'Pending' in case dgp has another opinion.
sf-robotplain2010-11-17 08:20:02
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
sf-robot Closed ticket [3098302fff]. [History diff]2010-11-17 08:20:03
Log in (anonymous is fine) to add a comment.

Attachments: