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