Some inputs make getwc(3) not to progress file descriptor and neither to
report EILSEQ. Detect such situation and skip the bad input.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
--- /dev/null
+789:;<=>=>?IABUVNXYZ[ `abcdefgg !"#$%&'()*+,-./01234)*:,-./0123456789:;[=>?1234)*:,-./0123456789:;[=>?4456789:;<=>?IABUVN`abcdefg !"
+ -
+return value: 0
--- /dev/null
+789:;<=>=>?IABUVNXYZ[_`abcdefgg\1f !"#$%&'()*+,-./01234)*:,-./0123456789:;[=>?1234)*:,-./0123456789:;[=>?4456789:;<=>?IABUVN`abcdefg\1f !" $%&'()*+,-./0123z{|ΓΌ~e
\ No newline at end of file
check_input_file() {
ts_init_subtest ${1##*/}
- $TS_CMD_COLCRT < $1 > $TS_OUTPUT 2>&1
+ timeout 2 $TS_CMD_COLCRT < $1 > $TS_OUTPUT 2>&1
echo "return value: $?" >> $TS_OUTPUT
ts_finalize_subtest
}
check_input_file "$TS_SELF/crash1"
check_input_file "$TS_SELF/crash2"
+check_input_file "$TS_SELF/hang1"
ts_finalize
{
int col;
wint_t c;
+ long old_pos;
ctl->print_nl = 1;
if (ctl->half_lines)
if (OUTPUT_COLS - 1 < col) {
output_lines(ctl, col);
errno = 0;
+ old_pos = ftell(ctl->f);
while ((c = getwc(ctl->f)) != L'\n') {
+ long new_pos = ftell(ctl->f);
+ if (old_pos == new_pos)
+ fseek(ctl->f, 1, SEEK_CUR);
+ else
+ old_pos = new_pos;
if (errno == 0 && c == WEOF)
return;
else