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