summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-09-08 22:36:58 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-09-08 22:36:58 (GMT)
commit9759bbcba71f400d022a28af45b8fa2a2fe26cc9 (patch)
treee5d893baaa622d3fde69b26c87e513dbb2ece6c1 /generic
parent700d951d9c38975ec0ecebf81e041ba444d0806b (diff)
downloadtcl-9759bbcba71f400d022a28af45b8fa2a2fe26cc9.zip
tcl-9759bbcba71f400d022a28af45b8fa2a2fe26cc9.tar.gz
tcl-9759bbcba71f400d022a28af45b8fa2a2fe26cc9.tar.bz2
Fix [Bug 1786481]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclDictObj.c17
-rw-r--r--generic/tclExecute.c5
2 files changed, 20 insertions, 2 deletions
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index 3fa5b65..d8e4165 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclDictObj.c,v 1.49 2007/04/24 20:46:09 dkf Exp $
+ * RCS: @(#) $Id: tclDictObj.c,v 1.50 2007/09/08 22:36:58 dkf Exp $
*/
#include "tclInt.h"
@@ -2744,6 +2744,14 @@ DictUpdateCmd(
objPtr = Tcl_ObjGetVar2(interp, objv[i+1], NULL, 0);
if (objPtr == NULL) {
Tcl_DictObjRemove(interp, dictPtr, objv[i]);
+ } else if (objPtr == dictPtr) {
+ /*
+ * Someone is messing us around, trying to build a recursive
+ * structure. [Bug 1786481]
+ */
+
+ Tcl_DictObjPut(interp, dictPtr, objv[i],
+ Tcl_DuplicateObj(objPtr));
} else {
/* Shouldn't fail */
Tcl_DictObjPut(interp, dictPtr, objv[i], objPtr);
@@ -2915,6 +2923,13 @@ DictWithCmd(
valPtr = Tcl_ObjGetVar2(interp, keyv[i], NULL, 0);
if (valPtr == NULL) {
Tcl_DictObjRemove(NULL, leafPtr, keyv[i]);
+ } else if (leafPtr == valPtr) {
+ /*
+ * Someone is messing us around, trying to build a recursive
+ * structure. [Bug 1786481]
+ */
+
+ Tcl_DictObjPut(NULL, leafPtr, keyv[i], Tcl_DuplicateObj(valPtr));
} else {
Tcl_DictObjPut(NULL, leafPtr, keyv[i], valPtr);
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 52f70a3..87b1024 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.329 2007/09/05 21:31:02 dgp Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.330 2007/09/08 22:36:59 dkf Exp $
*/
#include "tclInt.h"
@@ -6724,6 +6724,9 @@ TclExecuteByteCode(
}
if (valPtr == NULL) {
Tcl_DictObjRemove(interp, dictPtr, keyPtrPtr[i]);
+ } else if (dictPtr == valPtr) {
+ Tcl_DictObjPut(interp, dictPtr, keyPtrPtr[i],
+ Tcl_DuplicateObj(valPtr));
} else {
Tcl_DictObjPut(interp, dictPtr, keyPtrPtr[i], valPtr);
}