diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIO.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index e295c82..e8d231a 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.166 2009/11/10 23:50:17 ferrieux Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.167 2009/11/12 17:25:18 andreas_kupries Exp $ */ #include "tclInt.h" @@ -9092,14 +9092,17 @@ CopyData( sizeb = DoWriteChars(outStatePtr->topChanPtr, buffer, sizeb); } - if (inBinary || sameEncoding) { - /* - * Both read and write counted bytes. - */ - - size = sizeb; - } /* else: Read counted characters, write counted bytes, i.e. - * size != sizeb */ + /* + * [Bug 2895565]. At this point 'size' still contains the number of + * bytes or characters which have been read. We keep this to later to + * update the totals and toRead information, see marker (UP) below. We + * must not overwrite it with 'sizeb', which is the number of written + * bytes or characters, and both EOL translation and encoding + * conversion may have changed this number unpredictably in relation + * to 'size' (It can be smaller or larger, in the latter case able to + * drive toRead below -1, causing infinite looping). Completely + * unsuitable for updating totals and toRead. + */ if (sizeb < 0) { writeError: |