diff options
| author | dgp <dgp@users.sourceforge.net> | 2023-11-13 19:52:35 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2023-11-13 19:52:35 (GMT) |
| commit | 3052212deede1996f05bb96cdd0d96fb4c6f8279 (patch) | |
| tree | e83c325b0f758b1fb1ccdd51ce71dcb95974505a /generic/tclIO.c | |
| parent | 3d8bfac0f9513825f629f1ef4f95dd5e19c71002 (diff) | |
| parent | f0c0a10b82a9a0f7e1ce7900fe6b8be3b6f88e55 (diff) | |
| download | tcl-3052212deede1996f05bb96cdd0d96fb4c6f8279.zip tcl-3052212deede1996f05bb96cdd0d96fb4c6f8279.tar.gz tcl-3052212deede1996f05bb96cdd0d96fb4c6f8279.tar.bz2 | |
merge 8.7
Diffstat (limited to 'generic/tclIO.c')
| -rw-r--r-- | generic/tclIO.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 6461909..bc1b1c6 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -4749,6 +4749,12 @@ Tcl_GetsObj( ResetFlag(statePtr, CHANNEL_BLOCKED); while (1) { if (dst >= dstEnd) { + /* + * In case of encoding errors, state gets flag + * CHANNEL_ENCODING_ERROR set in the call below. First, the + * EOF/EOL condition is checked, as we may have valid data with + * EOF/EOL before the encoding error. + */ if (FilterInputBytes(chanPtr, &gs) != 0) { goto restore; } @@ -4918,8 +4924,17 @@ Tcl_GetsObj( } goto gotEOL; } else if (gs.bytesWrote == 0 - && GotFlag(statePtr, CHANNEL_ENCODING_ERROR) - && !GotFlag(statePtr, CHANNEL_NONBLOCKING)) { + && GotFlag(statePtr, CHANNEL_ENCODING_ERROR)) { + /* Ticket c4eb46a1 Harald Oehlmann 2023-11-12 debugging session. + * In non blocking mode we loop indifenitly on a decoding error in + * this while-loop. + * Removed the following from the upper condition: + * "&& !GotFlag(statePtr, CHANNEL_NONBLOCKING)" + * In case of an encoding error with leading correct bytes, we pass here + * two times, as gs.bytesWrote is not 0 on the first pass. This feels + * once to much, as the data is anyway not used. + */ + /* Set eol to the position that caused the encoding error, and then * continue to gotEOL, which stores the data that was decoded * without error to objPtr. This allows the caller to do something |
