summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-04-24 17:18:10 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-04-24 17:18:10 (GMT)
commitdc4a6bd185824428dbdbeb43e9ef2888dd8da7c8 (patch)
treefc74bc366fbe27ec3df9ec68668340e78d934318
parent877bccfda97bb0128ba071241fea5911def1448b (diff)
downloadtcl-dc4a6bd185824428dbdbeb43e9ef2888dd8da7c8.zip
tcl-dc4a6bd185824428dbdbeb43e9ef2888dd8da7c8.tar.gz
tcl-dc4a6bd185824428dbdbeb43e9ef2888dd8da7c8.tar.bz2
* generic/tclBinary.c: Addressed several code paths where the
error return from the 'binary format' command leaked the result buffer.
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclBinary.c7
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8e00089..d0eabf3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-04-24 Kevin B. Kenny <kennykb@acm.org>
+
+ * generic/tclBinary.c: Addressed several code paths where the
+ error return from the 'binary format' command leaked the result
+ buffer.
+
2007-04-24 Jeff Hobbs <jeffh@ActiveState.com>
*** 8.5a6 TAGGED FOR RELEASE ***
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 485383a..0512739 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBinary.c,v 1.34 2007/03/19 21:00:53 dgp Exp $
+ * RCS: @(#) $Id: tclBinary.c,v 1.35 2007/04/24 17:18:11 kennykb Exp $
*/
#include "tclInt.h"
@@ -829,6 +829,7 @@ Tcl_BinaryObjCmd(
value |= 1;
} else if (str[offset] != '0') {
errorValue = str;
+ Tcl_DecrRefCount(resultPtr);
goto badValue;
}
if (((offset + 1) % 8) == 0) {
@@ -843,6 +844,7 @@ Tcl_BinaryObjCmd(
value |= 128;
} else if (str[offset] != '0') {
errorValue = str;
+ Tcl_DecrRefCount(resultPtr);
goto badValue;
}
if (!((offset + 1) % 8)) {
@@ -886,6 +888,7 @@ Tcl_BinaryObjCmd(
value <<= 4;
if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */
errorValue = str;
+ Tcl_DecrRefCount(resultPtr);
goto badValue;
}
c = str[offset] - '0';
@@ -907,6 +910,7 @@ Tcl_BinaryObjCmd(
if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */
errorValue = str;
+ Tcl_DecrRefCount(resultPtr);
goto badValue;
}
c = str[offset] - '0';
@@ -975,6 +979,7 @@ Tcl_BinaryObjCmd(
arg++;
for (i = 0; i < count; i++) {
if (FormatNumber(interp, cmd, listv[i], &cursor)!=TCL_OK) {
+ Tcl_DecrRefCount(resultPtr);
return TCL_ERROR;
}
}