Blame SOURCES/bash42-043

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