summaryrefslogtreecommitdiffstats
path: root/generic/tclDictObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-09-09 04:14:28 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-09-09 04:14:28 (GMT)
commit8917ba0148b9ee83eb704cd8437e730cef6c2b30 (patch)
tree9155e3126703b4f0040a5478281e746e99dc4e75 /generic/tclDictObj.c
parent56fd59a807703c686a168d4f5673933b501eb84f (diff)
downloadtcl-8917ba0148b9ee83eb704cd8437e730cef6c2b30.zip
tcl-8917ba0148b9ee83eb704cd8437e730cef6c2b30.tar.gz
tcl-8917ba0148b9ee83eb704cd8437e730cef6c2b30.tar.bz2
merge updates from HEAD
Diffstat (limited to 'generic/tclDictObj.c')
-rw-r--r--generic/tclDictObj.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index 3fa5b65..ce25fa9 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.49.2.1 2007/09/09 04:14:28 dgp 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);
}