summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-11-12 23:42:17 (GMT)
committerhobbs <hobbs>2004-11-12 23:42:17 (GMT)
commit72e668e2300443e952f2105adad798d8f6a61c04 (patch)
treec1d85b45dd2118aa1efc6426dd4c9e1a54d60509 /generic/tclEncoding.c
parenta0b887545ab0caa15443e7a5dfa35e2ea5946b67 (diff)
downloadtcl-72e668e2300443e952f2105adad798d8f6a61c04.zip
tcl-72e668e2300443e952f2105adad798d8f6a61c04.tar.gz
tcl-72e668e2300443e952f2105adad798d8f6a61c04.tar.bz2
* generic/tclEncoding.c (TableFromUtfProc): correct crash
condition when TCL_UTF_MAX == 6. [Bug 1004065]
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index c8cdfb6..b24bb0e 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEncoding.c,v 1.25 2004/10/06 20:16:33 dkf Exp $
+ * RCS: @(#) $Id: tclEncoding.c,v 1.26 2004/11/12 23:42:17 hobbs Exp $
*/
#include "tclInt.h"
@@ -2333,7 +2333,18 @@ TableFromUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
break;
}
len = TclUtfToUniChar(src, &ch);
- word = fromUnicode[(ch >> 8)][ch & 0xff];
+
+#if TCL_UTF_MAX > 3
+ /*
+ * This prevents a crash condition. More evaluation is required
+ * for full support of int Tcl_UniChar. [Bug 1004065]
+ */
+ if (ch & 0xffff0000) {
+ word = 0;
+ } else
+#endif
+ word = fromUnicode[(ch >> 8)][ch & 0xff];
+
if ((word == 0) && (ch != 0)) {
if (flags & TCL_ENCODING_STOPONERROR) {
result = TCL_CONVERT_UNKNOWN;