07a490
			     BASH PATCH REPORT
07a490
			     =================
07a490
07a490
Bash-Release:	4.2
07a490
Patch-ID:	bash42-043
07a490
07a490
Bug-Reported-by:	konsolebox <konsolebox@gmail.com>
07a490
Bug-Reference-ID:	<CAJnmqwZuGKLgMsMwxRK4LL+2NN+HgvmKzrnode99QBGrcgX1Lw@mail.gmail.com>
07a490
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2013-01/msg00138.html
07a490
07a490
Bug-Description:
07a490
07a490
When SIGCHLD is trapped, and a SIGCHLD trap handler runs when a pending
07a490
`read -t' invocation times out and generates SIGALRM, bash can crash with
07a490
a segmentation fault.
07a490
07a490
Patch (apply with `patch -p0'):
07a490
07a490
*** ../bash-4.2-patched/builtins/read.def	2012-10-31 21:22:51.000517000 -0400
07a490
--- builtins/read.def	2013-01-25 10:28:16.000038000 -0500
07a490
***************
07a490
*** 386,393 ****
07a490
  	  /* Tricky.  The top of the unwind-protect stack is the free of
07a490
  	     input_string.  We want to run all the rest and use input_string,
07a490
! 	     so we have to remove it from the stack. */
07a490
! 	  remove_unwind_protect ();
07a490
! 	  run_unwind_frame ("read_builtin");
07a490
  	  input_string[i] = '\0';	/* make sure it's terminated */
07a490
  	  retval = 128+SIGALRM;
07a490
  	  goto assign_vars;
07a490
--- 386,403 ----
07a490
  	  /* Tricky.  The top of the unwind-protect stack is the free of
07a490
  	     input_string.  We want to run all the rest and use input_string,
07a490
! 	     so we have to save input_string temporarily, run the unwind-
07a490
! 	     protects, then restore input_string so we can use it later. */
07a490
! 
07a490
  	  input_string[i] = '\0';	/* make sure it's terminated */
07a490
+ 	  if (i == 0)
07a490
+ 	    {
07a490
+ 	      t = (char *)xmalloc (1);
07a490
+ 	      t[0] = 0;
07a490
+ 	    }
07a490
+ 	  else
07a490
+ 	    t = savestring (input_string);
07a490
+ 
07a490
+ 	  run_unwind_frame ("read_builtin");
07a490
+ 	  input_string = t;
07a490
  	  retval = 128+SIGALRM;
07a490
  	  goto assign_vars;
07a490
07a490
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
07a490
--- patchlevel.h	Thu Feb 24 21:41:34 2011
07a490
***************
07a490
*** 26,30 ****
07a490
     looks for to find the patch level (for the sccs version string). */
07a490
  
07a490
! #define PATCHLEVEL 42
07a490
  
07a490
  #endif /* _PATCHLEVEL_H_ */
07a490
--- 26,30 ----
07a490
     looks for to find the patch level (for the sccs version string). */
07a490
  
07a490
! #define PATCHLEVEL 43
07a490
  
07a490
  #endif /* _PATCHLEVEL_H_ */