Hideki IWAMOTO writes:

Current `tr' implementation has a problem, if `plain char' is signed.

[current cvs version]

>echo a | _install/usr/bin/tr '\0' '\377'
Segmentation fault (core dumped)

[patched version]

>echo a | _install/usr/bin/tr '\0' '\377'
a
This commit is contained in:
Eric Andersen 2004-03-12 22:10:40 +00:00
parent d20d37559f
commit ed43806c3b

View File

@ -202,9 +202,9 @@ extern int tr_main(int argc, char **argv)
map(input, input_length, output, output_length); map(input, input_length, output, output_length);
} }
for (i = 0; i < input_length; i++) for (i = 0; i < input_length; i++)
invec[(int)input[i]] = TRUE; invec[(unsigned char)input[i]] = TRUE;
for (i = 0; i < output_length; i++) for (i = 0; i < output_length; i++)
outvec[(int)output[i]] = TRUE; outvec[(unsigned char)output[i]] = TRUE;
} }
convert(); convert();
return (0); return (0);