diff options
author | Joe Mistachkin <joe@mistachkin.com> | 2015-06-04 20:49:11 (GMT) |
---|---|---|
committer | Joe Mistachkin <joe@mistachkin.com> | 2015-06-04 20:49:11 (GMT) |
commit | b56bbbb5de64f038ea17023cc8aa5afff73bbb10 (patch) | |
tree | 2b65e9c9640f7aa6860c2441a76daddf828865a2 | |
parent | 256df5a086b18e57f87787a7e23389d8d8e308cd (diff) | |
parent | f3337d5804891dde384cbc16b853b551ce5187d0 (diff) | |
download | tcl-b56bbbb5de64f038ea17023cc8aa5afff73bbb10.zip tcl-b56bbbb5de64f038ea17023cc8aa5afff73bbb10.tar.gz tcl-b56bbbb5de64f038ea17023cc8aa5afff73bbb10.tar.bz2 |
Merge updates from trunk.
-rw-r--r-- | generic/tclDisassemble.c | 2 | ||||
-rw-r--r-- | generic/tclExecute.c | 14 | ||||
-rw-r--r-- | tests/execute.test | 14 |
3 files changed, 24 insertions, 6 deletions
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index b3753c31..0a325b3 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -842,10 +842,10 @@ PrintSourceToObj( continue; } } - Tcl_AppendToObj(appendObj, "\"", -1); if (*p != '\0') { Tcl_AppendToObj(appendObj, "...", -1); } + Tcl_AppendToObj(appendObj, "\"", -1); } /* diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 43c2b08..4a6c009 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8235,6 +8235,7 @@ TEBCresume( bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL, NULL); opnd = TclGetUInt4AtPtr(pc+1); pc += (opnd-1); + assert(bytes); PUSH_OBJECT(Tcl_NewStringObj(bytes, length)); goto instEvalStk; } @@ -9900,7 +9901,12 @@ TclGetSourceFromFrame( cfPtr->cmd = GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc, codePtr, &cfPtr->len, NULL, NULL); } - cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); + if (cfPtr->cmd) { + cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); + } else { + cfPtr->cmdObj = Tcl_NewListObj(objc, objv); + cfPtr->cmd = Tcl_GetStringFromObj(cfPtr->cmdObj, &cfPtr->len); + } Tcl_IncrRefCount(cfPtr->cmdObj); } return cfPtr->cmdObj; @@ -9995,10 +10001,8 @@ GetSrcInfoForPc( int bestSrcLength = -1; /* Initialized to avoid compiler warning. */ int bestCmdIdx = -1; - if ((pcOffset < 0) || (pcOffset >= codePtr->numCodeBytes)) { - if (pcBeg != NULL) *pcBeg = NULL; - return NULL; - } + /* The pc must point within the bytecode */ + assert ((pcOffset >= 0) && (pcOffset < codePtr->numCodeBytes)); /* * Decode the code and source offset and length for each command. The diff --git a/tests/execute.test b/tests/execute.test index 94af158..aaf4bc0 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -1043,6 +1043,20 @@ test execute-11.1 {Bug 3142026: GrowEvaluationStack off-by-one} -setup { } -cleanup { interp delete slave } -result ok + +test execute-11.2 {Bug 268b23df11} -setup { + proc zero {} {return 0} + proc crash {} {expr {abs([zero])}} + proc noop args {} + trace add execution crash enterstep noop +} -body { + crash +} -cleanup { + trace remove execution crash enterstep noop + rename noop {} + rename crash {} + rename zero {} +} -result 0 # cleanup if {[info commands testobj] != {}} { |