bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

crash when using read -t


From: Pierre Gaston
Subject: crash when using read -t
Date: Mon, 14 Nov 2011 14:33:06 +0200

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]