summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--changes6
-rw-r--r--doc/msgcat.n2
-rw-r--r--generic/tcl.decls4
-rw-r--r--generic/tclCmdIL.c10
-rw-r--r--generic/tclIO.c2
-rw-r--r--generic/tclInt.decls5
-rw-r--r--generic/tclListObj.c10
-rw-r--r--generic/tclTomMath.decls2
-rw-r--r--generic/tclUtil.c8
-rw-r--r--unix/Makefile.in2
-rwxr-xr-xunix/configure2
-rw-r--r--unix/tcl.m42
-rw-r--r--win/Makefile.in2
-rw-r--r--win/makefile.vc4
-rw-r--r--win/nmakehlp.c15
15 files changed, 50 insertions, 26 deletions
diff --git a/changes b/changes
index 31757a0..d07ac1e 100644
--- a/changes
+++ b/changes
@@ -7967,4 +7967,10 @@ of Tcl_Channel (porter)
2015-10-21 (bug)[818a1a][a3c350][d7ea9f][8f2450][1080042] Many fixes and
improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
+2015-11-10 (bug)[261a8a] Overflow segfault in I/O translation (brooks,porter)
+
+2015-11-20 (bug)[3293874] let lists grow all the way to the limit (porter)
+
+2015-11-20 (bug)[40f628] ListObjReplace callers fail to detect max (porter)
+
--- Released 8.5.19, December 1, 2015 --- http://core.tcl.tk/tcl/ for details
diff --git a/doc/msgcat.n b/doc/msgcat.n
index bae6dbe..b4f7140 100644
--- a/doc/msgcat.n
+++ b/doc/msgcat.n
@@ -321,7 +321,7 @@ the package. For example, a short \fBes.msg\fR might contain:
.PP
.CS
namespace eval ::mypackage {
- \fB::msgcat::mcflset\fR "Free Beer!" "Cerveza Gracias!"
+ \fB::msgcat::mcflset\fR "Free Beer" "Cerveza Gratis"
}
.CE
.SH "RECOMMENDED MESSAGE SETUP FOR PACKAGES"
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 28cee54..92ccdcf 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -2,8 +2,8 @@
#
# This file contains the declarations for all supported public
# functions that are exported by the Tcl library via the stubs table.
-# This file is used to generate the tclDecls.h, tclPlatDecls.h,
-# tclStub.c, and tclPlatStub.c files.
+# This file is used to generate the tclDecls.h, tclPlatDecls.h
+# and tclStubInit.c files.
#
# Copyright (c) 1998-1999 by Scriptics Corporation.
# Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved.
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index ea9c1e4..02e5812 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -2233,7 +2233,10 @@ Tcl_LinsertObjCmd(
Tcl_ListObjAppendElement(NULL, listPtr, objv[3]);
} else {
- Tcl_ListObjReplace(NULL, listPtr, index, 0, (objc-3), &(objv[3]));
+ if (TCL_OK != Tcl_ListObjReplace(interp, listPtr, index, 0,
+ (objc-3), &(objv[3]))) {
+ return TCL_ERROR;
+ }
}
/*
@@ -2598,7 +2601,10 @@ Tcl_LreplaceObjCmd(
* optimize this case away.
*/
- Tcl_ListObjReplace(NULL, listPtr, first, numToDelete, objc-4, &(objv[4]));
+ if (TCL_OK != Tcl_ListObjReplace(interp, listPtr, first, numToDelete,
+ objc-4, &(objv[4]))) {
+ return TCL_ERROR;
+ }
/*
* Set the interpreter's object result.
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 9a4735f..7bc849e 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -5938,7 +5938,7 @@ TranslateInputEOL(
break;
default:
/* In other modes, at most 2 src bytes become a dst byte. */
- if (srcLen > 2 * dstLen) {
+ if (srcLen/2 > dstLen) {
srcLen = 2 * dstLen;
}
break;
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 102d04b..920116c 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -2,9 +2,8 @@
#
# This file contains the declarations for all unsupported
# functions that are exported by the Tcl library. This file
-# is used to generate the tclIntDecls.h, tclIntPlatDecls.h,
-# tclIntStub.c, tclPlatStub.c, tclCompileDecls.h and tclCompileStub.c
-# files
+# is used to generate the tclIntDecls.h, tclIntPlatDecls.h
+# and tclStubInit.c files
#
# Copyright (c) 1998-1999 by Scriptics Corporation.
# Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 289cf2d..c4b5cfc 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -854,8 +854,13 @@ Tcl_ListObjReplace(
count = numElems - first;
}
+ if (objc > LIST_MAX - (numElems - count)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "max length of a Tcl list (%d elements) exceeded", LIST_MAX));
+ return TCL_ERROR;
+ }
isShared = (listRepPtr->refCount > 1);
- numRequired = numElems - count + objc;
+ numRequired = numElems - count + objc; /* Known <= LIST_MAX */
for (i = 0; i < objc; i++) {
Tcl_IncrRefCount(objv[i]);
@@ -906,6 +911,8 @@ Tcl_ListObjReplace(
listRepPtr = AttemptNewList(interp, newMax, NULL);
if (listRepPtr == NULL) {
+ listRepPtr = AttemptNewList(interp, numRequired, NULL);
+ if (listRepPtr == NULL) {
for (i = 0; i < objc; i++) {
/* See bug 3598580 */
#if TCL_MAJOR_VERSION > 8
@@ -916,6 +923,7 @@ Tcl_ListObjReplace(
}
return TCL_ERROR;
}
+ }
listPtr->internalRep.twoPtrValue.ptr1 = (void *) listRepPtr;
listRepPtr->refCount++;
diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls
index 1bfc443..ab39e83 100644
--- a/generic/tclTomMath.decls
+++ b/generic/tclTomMath.decls
@@ -3,7 +3,7 @@
# This file contains the declarations for the functions in
# 'libtommath' that are contained within the Tcl library.
# This file is used to generate the 'tclTomMathDecls.h' and
-# 'tclTomMathStub.c' files.
+# 'tclStubInit.c' files.
#
# If you edit this file, advance the revision number (and the epoch
# if the new stubs are not backward compatible) in tclTomMathDecls.h
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 69d0b17..bc1490e 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1791,7 +1791,12 @@ Tcl_ConcatObj(
TclListObjGetElements(NULL, objPtr, &listc, &listv);
if (listc) {
if (resPtr) {
- Tcl_ListObjReplace(NULL, resPtr, INT_MAX, 0, listc, listv);
+ if (TCL_OK != Tcl_ListObjReplace(NULL, resPtr,
+ INT_MAX, 0, listc, listv)) {
+ /* Abandon ship! */
+ Tcl_DecrRefCount(resPtr);
+ goto slow;
+ }
} else {
resPtr = TclListObjCopy(NULL, objPtr);
}
@@ -1808,6 +1813,7 @@ Tcl_ConcatObj(
* the slow way, using the string representations.
*/
+ slow:
/* First try to pre-allocate the size required */
for (i = 0; i < objc; i++) {
element = TclGetStringFromObj(objv[i], &elemLength);
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 1f2cd77..84d0391 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -560,7 +560,7 @@ ${LIB_FILE}: ${STUB_LIB_FILE} ${OBJS}
${STUB_LIB_FILE}: ${STUB_LIB_OBJS}
@if test "x${LIB_FILE}" = "xlibtcl${MAJOR_VERSION}.${MINOR_VERSION}.dll"; then \
- (cd ${TOP_DIR}/win; ${MAKE} libtclstub${MAJOR_VERSION}${MINOR_VERSION}.a); \
+ (cd ${TOP_DIR}/win; ${MAKE} winextensions); \
fi
rm -f $@
@MAKE_STUB_LIB@
diff --git a/unix/configure b/unix/configure
index 9ab51f0..7ff9f72 100755
--- a/unix/configure
+++ b/unix/configure
@@ -8880,7 +8880,7 @@ fi
MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
if test "${SHLIB_SUFFIX}" = ".dll"; then
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;'
DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
else
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 7a0b677..a7faae5 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -2069,7 +2069,7 @@ dnl # preprocessing tests use only CPPFLAGS.
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;'
DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
], [
INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
diff --git a/win/Makefile.in b/win/Makefile.in
index e9a28c4..ada9448 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -400,6 +400,8 @@ winhelp: $(ROOT_DIR)/tools/man2help.tcl $(MAN2TCL)
./$(TCLSH) "$(ROOT_DIR_NATIVE)"/tools/man2help.tcl tcl "$(VER)" $(TCL_DOCS)
hcw /c /e tcl.hpj
+winextensions: ${DDE_DLL_FILE} ${REG_DLL_FILE}
+
$(MAN2TCL): $(ROOT_DIR)/tools/man2tcl.c
$(CC) $(CFLAGS_OPTIMIZE) $(MAN2TCLFLAGS) -o $(MAN2TCL) "$(ROOT_DIR_NATIVE)"/tools/man2tcl.c
diff --git a/win/makefile.vc b/win/makefile.vc
index 267f53f..8c8ecdf 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -1012,10 +1012,6 @@ install-libraries: tclConfig install-msgs install-tzdata
$(MKDIR) "$(SCRIPT_INSTALL_DIR)"
@if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8$(NULL)" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.2$(NULL)" \
- $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.2"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.3$(NULL)" \
- $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.3"
@if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4$(NULL)" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4"
@if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform$(NULL)" \
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index d0edcf0..84cf75c 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -498,9 +498,10 @@ GetVersionFromFile(
p = strstr(szBuffer, match);
if (p != NULL) {
/*
- * Skip to first digit.
+ * Skip to first digit after the match.
*/
+ p += strlen(match);
while (*p && !isdigit(*p)) {
++p;
}
@@ -605,8 +606,8 @@ SubstituteFile(
sp = fopen(substitutions, "rt");
if (sp != NULL) {
while (fgets(szBuffer, cbBuffer, sp) != NULL) {
- char *ks, *ke, *vs, *ve;
- ks = szBuffer;
+ unsigned char *ks, *ke, *vs, *ve;
+ ks = (unsigned char*)szBuffer;
while (ks && *ks && isspace(*ks)) ++ks;
ke = ks;
while (ke && *ke && !isspace(*ke)) ++ke;
@@ -615,7 +616,7 @@ SubstituteFile(
ve = vs;
while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
*ke = 0, *ve = 0;
- list_insert(&substPtr, ks, vs);
+ list_insert(&substPtr, (char*)ks, (char*)vs);
}
fclose(sp);
}
@@ -630,11 +631,11 @@ SubstituteFile(
}
}
#endif
-
+
/*
* Run the substitutions over each line of the input
*/
-
+
while (fgets(szBuffer, cbBuffer, fp) != NULL) {
list_item_t *p = NULL;
for (p = substPtr; p != NULL; p = p->nextPtr) {
@@ -654,7 +655,7 @@ SubstituteFile(
}
printf(szBuffer);
}
-
+
list_free(&substPtr);
}
fclose(fp);