BASH PATCH REPORT
                            =================

Bash-Release:   4.3
Patch-ID:       bash43-020

Bug-Reported-by:        Jared Yanovich <[email protected]>
Bug-Reference-ID:       <[email protected]>
Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00065.html

Bug-Description:

When PS2 contains a command substitution, here-documents entered in an
interactive shell can sometimes cause a segmentation fault.

Patch (apply with `patch -p0'):

*** ../bash-4.3-patched/shell.h 2012-12-25 21:11:01.000000000 -0500
--- shell.h     2014-06-03 09:24:28.000000000 -0400
***************
*** 169,173 ****
   int expand_aliases;
   int echo_input_at_read;
!
 } sh_parser_state_t;

--- 169,174 ----
   int expand_aliases;
   int echo_input_at_read;
!   int need_here_doc;
!
 } sh_parser_state_t;

*** ../bash-4.3-patched/parse.y 2014-05-14 09:16:40.000000000 -0400
--- parse.y     2014-04-30 09:27:59.000000000 -0400
***************
*** 2643,2647 ****

   r = 0;
!   while (need_here_doc)
     {
       parser_state |= PST_HEREDOC;
--- 2643,2647 ----

   r = 0;
!   while (need_here_doc > 0)
     {
       parser_state |= PST_HEREDOC;
***************
*** 6076,6079 ****
--- 6076,6080 ----
   ps->expand_aliases = expand_aliases;
   ps->echo_input_at_read = echo_input_at_read;
+   ps->need_here_doc = need_here_doc;

   ps->token = token;
***************
*** 6124,6127 ****
--- 6125,6129 ----
   expand_aliases = ps->expand_aliases;
   echo_input_at_read = ps->echo_input_at_read;
+   need_here_doc = ps->need_here_doc;

   FREE (token);
*** ../bash-4.3-patched/y.tab.c 2014-04-07 11:56:12.000000000 -0400
--- y.tab.c     2014-07-30 09:55:57.000000000 -0400
***************
*** 4955,4959 ****

   r = 0;
!   while (need_here_doc)
     {
       parser_state |= PST_HEREDOC;
--- 5151,5155 ----

   r = 0;
!   while (need_here_doc > 0)
     {
       parser_state |= PST_HEREDOC;
***************
*** 8388,8391 ****
--- 8584,8588 ----
   ps->expand_aliases = expand_aliases;
   ps->echo_input_at_read = echo_input_at_read;
+   ps->need_here_doc = need_here_doc;

   ps->token = token;
***************
*** 8436,8439 ****
--- 8633,8637 ----
   expand_aliases = ps->expand_aliases;
   echo_input_at_read = ps->echo_input_at_read;
+   need_here_doc = ps->need_here_doc;

   FREE (token);
*** ../bash-4.3/patchlevel.h    2012-12-29 10:47:57.000000000 -0500
--- patchlevel.h        2014-03-20 20:01:28.000000000 -0400
***************
*** 26,30 ****
    looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 19

 #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
    looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 20

 #endif /* _PATCHLEVEL_H_ */