summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclCmdIL.c4
-rw-r--r--generic/tclExecute.c4
-rw-r--r--generic/tclProc.c2
-rw-r--r--generic/tclVar.c3
-rw-r--r--tests/dict.test7
5 files changed, 16 insertions, 4 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 0d35397..c93e593 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -1203,7 +1203,7 @@ InfoFrameCmd(
levelError:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad level \"%s\"", TclGetString(objv[1])));
- Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "STACK_FRAME",
+ Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LEVEL",
TclGetString(objv[1]), NULL);
code = TCL_ERROR;
goto done;
@@ -1638,7 +1638,7 @@ InfoLevelCmd(
levelError:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad level \"%s\"", TclGetString(objv[1])));
- Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "STACK_LEVEL",
+ Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LEVEL",
TclGetString(objv[1]), NULL);
return TCL_ERROR;
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index aed6a48..355b667 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -7707,6 +7707,7 @@ TEBCresume(
goto gotError;
}
}
+ Tcl_IncrRefCount(dictPtr);
if (TclListObjGetElements(interp, OBJ_AT_TOS, &length,
&keyPtrPtr) != TCL_OK) {
TRACE_ERROR(interp);
@@ -7719,6 +7720,7 @@ TEBCresume(
if (Tcl_DictObjGet(interp, dictPtr, keyPtrPtr[i],
&valuePtr) != TCL_OK) {
TRACE_ERROR(interp);
+ Tcl_DecrRefCount(dictPtr);
goto gotError;
}
varPtr = LOCAL(duiPtr->varIndices[i]);
@@ -7735,10 +7737,12 @@ TEBCresume(
duiPtr->varIndices[i]) == NULL) {
CACHE_STACK_INFO();
TRACE_ERROR(interp);
+ Tcl_DecrRefCount(dictPtr);
goto gotError;
}
CACHE_STACK_INFO();
}
+ TclDecrRefCount(dictPtr);
TRACE_APPEND(("OK\n"));
NEXT_INST_F(9, 0, 0);
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 70178f4..b663caf 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -869,7 +869,7 @@ TclObjGetFrame(
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad level \"%s\"", name));
- Tcl_SetErrorCode(interp, "TCL", "VALUE", "STACKLEVEL", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LEVEL", name, NULL);
return -1;
}
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 5574f30..51e2482 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -4938,7 +4938,8 @@ Tcl_UpvarObjCmd(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad level \"%s\"", TclGetString(levelObj)));
- Tcl_SetErrorCode(interp, "TCL", "VALUE", "LEVEL", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LEVEL",
+ TclGetString(levelObj), NULL);
return TCL_ERROR;
}
diff --git a/tests/dict.test b/tests/dict.test
index d5406d0..a6b0cb4 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -2048,6 +2048,13 @@ test dict-24.25 {dict map with huge dict (compiled)} {
}} 100000
} 166666666600000
+test dict-25.1 {compiled dict update with low-refcount values [Bug d553228d9f]} {
+ # Test crashes on failure
+ apply {{} {
+ lassign {} item
+ dict update item item item two two {}
+ }}
+} {}
# cleanup
::tcltest::cleanupTests