diff options
author | jenglish <jenglish@flightlab.com> | 2008-07-04 19:21:14 (GMT) |
---|---|---|
committer | jenglish <jenglish@flightlab.com> | 2008-07-04 19:21:14 (GMT) |
commit | 55aaafebf11934aa7c0820362b78688e70c95438 (patch) | |
tree | 2dd491b430d34403df3774b0cdad677d3a2533b5 | |
parent | 249cb51f56621900b972cbbc766b6a4afe7a5331 (diff) | |
download | tcl-55aaafebf11934aa7c0820362b78688e70c95438.zip tcl-55aaafebf11934aa7c0820362b78688e70c95438.tar.gz tcl-55aaafebf11934aa7c0820362b78688e70c95438.tar.bz2 |
UtfToUtfProc: Avoid unwanted sign extension when converting incomplete UTF-8
sequences. See [Bug 1908443] for details.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclEncoding.c | 6 |
2 files changed, 9 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2008-07-04 Joe English <jenglish@users.sourceforge.net> + + * generic/tclEncoding.c(UtfToUtfProc): Avoid unwanted sign extension + when converting incomplete UTF-8 sequences. See [Bug 1908443] for + details. + 2008-07-03 Don Porter <dgp@users.sourceforge.net> * library/package.tcl: Removed [file readable] testing from diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 1a3faa3..99c71b0 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.16.2.14 2007/02/12 19:25:42 andreas_kupries Exp $ + * RCS: @(#) $Id: tclEncoding.c,v 1.16.2.15 2008/07/04 19:21:19 jenglish Exp $ */ #include "tclInt.h" @@ -2084,11 +2084,11 @@ UtfToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, } else if (!Tcl_UtfCharComplete(src, srcEnd - src)) { /* Always check before using Tcl_UtfToUniChar. Not doing * can so cause it run beyond the endof the buffer! If we - * * happen such an incomplete char its byts are made to * + * happen such an incomplete char its bytes are made to * represent themselves. */ - ch = (Tcl_UniChar) *src; + ch = (unsigned char) *src; src += 1; dst += Tcl_UniCharToUtf(ch, dst); } else { |