From 55aaafebf11934aa7c0820362b78688e70c95438 Mon Sep 17 00:00:00 2001 From: jenglish Date: Fri, 4 Jul 2008 19:21:14 +0000 Subject: UtfToUtfProc: Avoid unwanted sign extension when converting incomplete UTF-8 sequences. See [Bug 1908443] for details. --- ChangeLog | 6 ++++++ generic/tclEncoding.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8907760..5527cdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-04 Joe English + + * generic/tclEncoding.c(UtfToUtfProc): Avoid unwanted sign extension + when converting incomplete UTF-8 sequences. See [Bug 1908443] for + details. + 2008-07-03 Don Porter * 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 { -- cgit v0.12