? tools/man2tcl ? unix/linux-ix86 ? unix/buffer.tcl Index: ChangeLog =================================================================== RCS file: /cvsroot/tcl/tcl/ChangeLog,v retrieving revision 1.491 diff -u -r1.491 ChangeLog --- ChangeLog 2001/07/06 22:03:11 1.491 +++ ChangeLog 2001/07/17 17:46:01 @@ -1,3 +1,13 @@ +2001-07-17 Andreas Kupries + + * generic/tclIO.c (GetInput): Fixed [SF #427196]. Memory was + overwritten because a buffer was used after a change of the + requested buffersize together with that requested buffersize and + not its actual size, which was smaller. Note that the continous + reuse of the smaller buffer negatively impacts performance. The + system never allocates a buffer with the newly requested bigger + buffersize. + 2001-07-06 Mo DeJong * win/configure: Regen. Index: generic/tclIO.c =================================================================== RCS file: /cvsroot/tcl/tcl/generic/tclIO.c,v retrieving revision 1.30 diff -u -r1.30 tclIO.c --- generic/tclIO.c 2001/05/19 16:59:04 1.30 +++ generic/tclIO.c 2001/07/17 17:46:01 @@ -4999,7 +4999,21 @@ } bufPtr->nextPtr = (ChannelBuffer *) NULL; - toRead = statePtr->bufSize; + /* SF #427196: Use the actual size of the buffer to determine + * the number of bytes to read from the channel and not the + * size for new buffers. They can be different if the + * buffersize was changed between reads. + * + * Note: This affects performance negatively if the buffersize + * was extended but this small buffer is reused for all + * subsequent reads. The system never uses buffers with the + * requested bigger size in that case. An adjunct patch could + * try and delete all unused buffers it encounters and which + * are smaller than the formally requested buffersize. + */ + + toRead = bufPtr->bufLength - bufPtr->nextAdded; + if (statePtr->inQueueTail == NULL) { statePtr->inQueueHead = bufPtr; } else {