|
2002-01-21
| ||
| 12:53 | • Closed ticket [506292ffff]: May generate unlimited output plus 7 other chang... artifact: c13987d428 user: andreas_kupries | |
| 05:29 | • New ticket [506292ffff]. artifact: ffbf75de5e user: nobody | |
May generate unlimited output
Closed / Duplicate506292ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-01-21 05:29:39
This happens on tcl8.3.4 (also tested on 8.3.3) on Linux. I have a channel open for writing with encoding iso2022-jp. When I "puts" a certain string tcl gets stuck in a loop and the output file starts growing indefinitely. The problem can be demonstrated by the following script: set string [format %s%c [string repeat " " 4094] 12399] set f [open out w 0644] fconfigure $f -encoding iso2022-jp puts -nonewline $f $string close $f This script will, when executed, never get past teh puts statement and the outfile will start to grow (fast:-). The problem lies in WriteChars in tclIO.c. When Tcl_UtfToExternal is called with TCL_ENCODING_START set among the flags, then it will always generate at least three bytes (assuming the output encoding is iso2022-jp). However it did not consume any of the characters in the input buffer (at least not if TCL_ENCODING_END is clear). But the logic in WriteChars thinks that since it generated output we shoudl call it again... The attached patch fixes this by removing the TCL_ENCODING_START bit from flags after the first call to Tcl_UtfToExternal
andreas_kupriesplain2002-01-21 12:53:46
Logged In: YES user_id=75003 Duplicate of http://sourceforge.net/tracker/?func=detail&aid=506297&group_id=10894&atid=110894
Log in (anonymous is fine) to add a comment.