diff options
| author | dgp <dgp@users.sourceforge.net> | 2015-06-04 11:49:18 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2015-06-04 11:49:18 (GMT) |
| commit | 6ae60815c716d963d40d019253dd621c2826a05b (patch) | |
| tree | f904084d1c5e2acbe3a3b04681fbb0775b892011 | |
| parent | 8a16ff2b7f5ed8a2c8065c50098b716dea999aea (diff) | |
| parent | 6f63d23863d8c38063f6a6689706fa8e9fae2469 (diff) | |
| download | tcl-6ae60815c716d963d40d019253dd621c2826a05b.zip tcl-6ae60815c716d963d40d019253dd621c2826a05b.tar.gz tcl-6ae60815c716d963d40d019253dd621c2826a05b.tar.bz2 | |
merge 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 b9864bc..d476657 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8093,6 +8093,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; } @@ -9750,7 +9751,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; @@ -9845,10 +9851,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 e0b68e5..d3c521c 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] != {}} { |
