summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-24 13:02:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-24 13:02:45 (GMT)
commit0f1fe8880dc481b214a344189a6a6904b59eede0 (patch)
tree912f2f1b3e56524018e9ba33f9666bb1ff7e1435
parentaf74f1af12dc408e48402831f746b42cf365baf7 (diff)
downloadtcl-0f1fe8880dc481b214a344189a6a6904b59eede0.zip
tcl-0f1fe8880dc481b214a344189a6a6904b59eede0.tar.gz
tcl-0f1fe8880dc481b214a344189a6a6904b59eede0.tar.bz2
Make all internal small buffer related to Tcl_UtfBackslash() length 4, not TCL_UTF_MAX: For TCL_UTF_MAX=6 it was overkill, for TCL_UTF_MAX=3 not enough.
Prove that this works by adding a Travis CI build configuration using TCL_UTF_MAX=3
-rw-r--r--.travis.yml43
-rw-r--r--generic/tclCompCmdsSZ.c2
-rw-r--r--generic/tclCompExpr.c2
-rw-r--r--generic/tclCompile.c4
-rw-r--r--generic/tclParse.c4
-rw-r--r--generic/tclUtil.c2
6 files changed, 50 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml
index e1751c4..3770e07 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -92,6 +92,18 @@ matrix:
- g++-7
env:
- BUILD_DIR=unix
+ - CFGOPT=CFLAGS=-DTCL_UTF_MAX=3
+ - os: linux
+ dist: xenial
+ compiler: gcc-7
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - g++-7
+ env:
+ - BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_NO_DEPRECATED=1
- os: osx
osx_image: xcode8
@@ -164,6 +176,22 @@ matrix:
- wine
env:
- BUILD_DIR=win
+ - CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_UTF_MAX=3"
+ - NO_DIRECT_TEST=1
+ - os: linux
+ dist: xenial
+ compiler: i686-w64-mingw32-gcc
+ addons:
+ apt:
+ packages:
+ - gcc-mingw-w64-base
+ - binutils-mingw-w64-i686
+ - gcc-mingw-w64-i686
+ - gcc-mingw-w64
+ - gcc-multilib
+ - wine
+ env:
+ - BUILD_DIR=win
- CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_NO_DEPRECATED=1"
- NO_DIRECT_TEST=1
# Test with mingw-w64 (64 bit)
@@ -210,6 +238,21 @@ matrix:
- wine
env:
- BUILD_DIR=win
+ - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_UTF_MAX=3"
+ - NO_DIRECT_TEST=1
+ - os: linux
+ dist: xenial
+ compiler: x86_64-w64-mingw32-gcc
+ addons:
+ apt:
+ packages:
+ - gcc-mingw-w64-base
+ - binutils-mingw-w64-x86-64
+ - gcc-mingw-w64-x86-64
+ - gcc-mingw-w64
+ - wine
+ env:
+ - BUILD_DIR=win
- CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_NO_DEPRECATED=1"
- NO_DIRECT_TEST=1
before_install:
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index b97121e..07e7bcc 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -1502,7 +1502,7 @@ TclSubstCompile(
for (endTokenPtr = tokenPtr + parse.numTokens;
tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
int length, literal, catchRange, breakJump;
- char buf[TCL_UTF_MAX] = "";
+ char buf[4] = "";
JumpFixup startFixup, okFixup, returnFixup, breakFixup;
JumpFixup continueFixup, otherFixup, endFixup;
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index f88b2d6..56c8931 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -2066,7 +2066,7 @@ ParseLexeme(
if (Tcl_UtfCharComplete(start, numBytes)) {
scanned = TclUtfToUniChar(start, &ch);
} else {
- char utfBytes[TCL_UTF_MAX];
+ char utfBytes[4];
memcpy(utfBytes, start, numBytes);
utfBytes[numBytes] = '\0';
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 3621cc2..c0e8c62 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1744,7 +1744,7 @@ TclWordKnownAtCompileTime(
case TCL_TOKEN_BS:
if (tempPtr != NULL) {
- char utfBuf[TCL_UTF_MAX] = "";
+ char utfBuf[4] = "";
int length = TclParseBackslash(tokenPtr->start,
tokenPtr->size, NULL, utfBuf);
@@ -2358,7 +2358,7 @@ TclCompileTokens(
{
Tcl_DString textBuffer; /* Holds concatenated chars from adjacent
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
- char buffer[TCL_UTF_MAX] = "";
+ char buffer[4] = "";
int i, numObjsToConcat, length, adjust;
unsigned char *entryCodeNext = envPtr->codeNext;
#define NUM_STATIC_POS 20
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 2419026..164905a 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -791,7 +791,7 @@ TclParseBackslash(
Tcl_UniChar unichar = 0;
int result;
int count;
- char buf[TCL_UTF_MAX] = "";
+ char buf[4] = "";
if (numBytes == 0) {
if (readPtr != NULL) {
@@ -2151,7 +2151,7 @@ TclSubstTokens(
Tcl_Obj *appendObj = NULL;
const char *append = NULL;
int appendByteLength = 0;
- char utfCharBytes[TCL_UTF_MAX] = "";
+ char utfCharBytes[4] = "";
switch (tokenPtr->type) {
case TCL_TOKEN_TEXT:
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index eb77dd1..0788aed 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1654,7 +1654,7 @@ Tcl_Backslash(
int *readPtr) /* Fill in with number of characters read from
* src, unless NULL. */
{
- char buf[TCL_UTF_MAX] = "";
+ char buf[4] = "";
Tcl_UniChar ch = 0;
Tcl_UtfBackslash(src, readPtr, buf);