On Linux, I get an assertion error, using the following example:
$ for i in {1..1000};do read -t .02 </dev/zero;done
malloc: ./read.def:690: assertion botched
free: start and end chunk sizes differ
last command: for i in {1..1000};do read -t .02 </dev/zero;done
Aborting...Aborted
I think the problem is that sigalarm can occur after xrealloc but
before the remove_unwind_protect (in read.def, line 523 or so):
if (i + 4 >= size) /* XXX was i + 2; use i + 4 for multibyte/read_mbchar */
{
input_string = (char *)xrealloc (input_string, size += 128);
remove_unwind_protect ();
add_unwind_protect (xfree, input_string);
}
at least blocking and unblocking ALRM around this seems to fix the crash.
Pierre