summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-12-14 19:25:04 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-12-14 19:25:04 (GMT)
commitad47aaa8d919090d79a2ce390b08653ef8e3fae8 (patch)
tree95baaaf86795c70b594ff3fa78b62dc588c4e242
parent55ceb591d7bd0c530c73961be1c05996e8cc5920 (diff)
parent4eaff43e124f523dca05591bc760fa9f32eb7672 (diff)
downloadtcl-ad47aaa8d919090d79a2ce390b08653ef8e3fae8.zip
tcl-ad47aaa8d919090d79a2ce390b08653ef8e3fae8.tar.gz
tcl-ad47aaa8d919090d79a2ce390b08653ef8e3fae8.tar.bz2
merge trunk, update changes and re-tagcore_8_6_0core_8_6_0_rc
-rw-r--r--ChangeLog24
-rw-r--r--changes4
-rw-r--r--generic/tcl.h12
-rw-r--r--generic/tclCmdAH.c3
-rw-r--r--generic/tclZlib.c19
-rw-r--r--tests/cmdAH.test6
-rw-r--r--tests/zlib.test14
7 files changed, 59 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 256aa58..38da6f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,29 @@
-2012-12-11 Don Porter <dgp@users.sourceforge.net>
+2012-12-14 Don Porter <dgp@users.sourceforge.net>
*** 8.6.0 TAGGED FOR RELEASE ***
+ * changes: updates for 8.6.0
+
+2012-12-13 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclZlib.c: Repair same issue with misusing the
+ * tests/zlib.test: 'fire and forget' nature of Tcl_ObjSetVar2
+ in the new TIP 400 implementation.
+
+2012-12-13 Miguel Sofer <msofer@users.sf.net>
+
+ * generic/tclCmdAH.c: (CatchObjCmdCallback): do not decrRefCount
+ * tests/cmdAH.test: the newValuePtr sent to Tcl_ObjSetVar2:
+ TOSV2 is 'fire and forget', it decrs on its own.
+ Fix for [Bug 3595576], found by andrewsh.
+
+2012-12-13 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tcl.h: Fix Tcl_DecrRefCount macro such that it
+ doesn't access its objPtr parameter twice any more.
+
+2012-12-11 Don Porter <dgp@users.sourceforge.net>
+
* generic/tcl.h: Bump version number to 8.6.0.
* library/init.tcl:
* unix/configure.in:
diff --git a/changes b/changes
index b517cec..63c3877 100644
--- a/changes
+++ b/changes
@@ -8158,4 +8158,8 @@ Dropped support for OS X versions less than 10.4 (Tiger) (fellows)
2012-12-03 (bug fix) [configure] query broke init from argv (porter)
=> tcltest 2.3.5
+2012-12-13 (bug fix)[3595576] crash: [catch {} -> noSuchNs::var] (sofer,porter)
+
+2012-12-13 (bug fix) crash: [zlib gunzip $data -header noSuchNs::var] (porter)
+
--- Released 8.6.0, December 20, 2012 --- See ChangeLog for details ---
diff --git a/generic/tcl.h b/generic/tcl.h
index 6a6ac9b..3003abf 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -854,10 +854,7 @@ typedef struct Tcl_Obj {
* whether an object is shared (i.e. has reference count > 1). Note: clients
* should use Tcl_DecrRefCount() when they are finished using an object, and
* should never call TclFreeObj() directly. TclFreeObj() is only defined and
- * made public in tcl.h to support Tcl_DecrRefCount's macro definition. Note
- * also that Tcl_DecrRefCount() refers to the parameter "obj" twice. This
- * means that you should avoid calling it with an expression that is expensive
- * to compute or has side effects.
+ * made public in tcl.h to support Tcl_DecrRefCount's macro definition.
*/
void Tcl_IncrRefCount(Tcl_Obj *objPtr);
@@ -2504,7 +2501,12 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
* http://c2.com/cgi/wiki?TrivialDoWhileLoop
*/
# define Tcl_DecrRefCount(objPtr) \
- do { if (--(objPtr)->refCount <= 0) TclFreeObj(objPtr); } while(0)
+ do { \
+ Tcl_Obj *_objPtr = (objPtr); \
+ if (--(_objPtr)->refCount <= 0) { \
+ TclFreeObj(_objPtr); \
+ } \
+ } while(0)
# define Tcl_IsShared(objPtr) \
((objPtr)->refCount > 1)
#endif
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 14951e4..133a61b 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -361,7 +361,8 @@ CatchObjCmdCallback(
if (NULL == Tcl_ObjSetVar2(interp, optionVarNamePtr, NULL,
options, TCL_LEAVE_ERR_MSG)) {
- Tcl_DecrRefCount(options);
+ /* Do not decrRefCount 'options', it was already done by
+ * Tcl_ObjSetVar2 */
return TCL_ERROR;
}
}
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 8fbe049..9c1176e 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -507,7 +507,7 @@ GenerateHeader(
* ExtractHeader --
*
* Take the values out of a gzip header and store them in a dictionary.
- * SetValue is a helper function.
+ * SetValue is a helper macro.
*
* Results:
* None.
@@ -518,18 +518,8 @@ GenerateHeader(
*----------------------------------------------------------------------
*/
-static inline void
-SetValue(
- Tcl_Obj *dictObj,
- const char *key,
- Tcl_Obj *value)
-{
- Tcl_Obj *keyObj = Tcl_NewStringObj(key, -1);
-
- Tcl_IncrRefCount(keyObj);
- Tcl_DictObjPut(NULL, dictObj, keyObj, value);
- TclDecrRefCount(keyObj);
-}
+#define SetValue(dictObj, key, value) \
+ Tcl_DictObjPut(NULL, (dictObj), Tcl_NewStringObj((key), -1), (value))
static void
ExtractHeader(
@@ -2119,9 +2109,6 @@ ZlibCmd(
}
if (headerVarObj != NULL && Tcl_ObjSetVar2(interp, headerVarObj, NULL,
headerDictObj, TCL_LEAVE_ERR_MSG) == NULL) {
- if (headerDictObj) {
- TclDecrRefCount(headerDictObj);
- }
return TCL_ERROR;
}
return TCL_OK;
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index 2ecf626..3051bfb 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -70,6 +70,12 @@ test cmdAH-1.2 {Tcl_CatchObjCmd, errors} {
test cmdAH-1.3 {Tcl_CatchObjCmd, errors} -returnCodes error -body {
catch foo bar baz spaz
} -result {wrong # args: should be "catch script ?resultVarName? ?optionVarName?"}
+test cmdAH-1.4 {Bug 3595576} {
+ catch {catch {} -> noSuchNs::var}
+} 1
+test cmdAH-1.5 {Bug 3595576} {
+ catch {catch error -> noSuchNs::var}
+} 1
test cmdAH-2.1 {Tcl_CdObjCmd} -returnCodes error -body {
cd foo bar
diff --git a/tests/zlib.test b/tests/zlib.test
index 5f1e5fc..891dba0 100644
--- a/tests/zlib.test
+++ b/tests/zlib.test
@@ -826,6 +826,20 @@ test zlib-11.2 "Bug #3390073: mis-appled gzip filtering" -setup {
} -cleanup {
removeFile $file
} -result {1000 /foo/bar 0}
+test zlib-11.3 {Bug 3595576 variant} -setup {
+ set file [makeFile {} test.input]
+} -constraints zlib -body {
+ set f [open $file wb]
+ puts -nonewline [zlib push gzip $f -header {filename /foo/bar}] \
+ [string repeat "hello" 1000]
+ close $f
+ set f [open $file rb]
+ set d [read $f]
+ close $f
+ zlib gunzip $d -header noSuchNs::foo
+} -cleanup {
+ removeFile $file
+} -returnCodes error -result {can't set "noSuchNs::foo": parent namespace doesn't exist}
::tcltest::cleanupTests
return