Commit 5bedeb2f authored by Gustavo Zacarias's avatar Gustavo Zacarias Committed by Peter Korsgaard
Browse files

bash: bump to version 4.2 pl20

parent ce7a7896
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-011

Bug-Reported-by:	"David Parks" <davidparks21@yahoo.com>
Bug-Reference-ID:	<014101cc82c6$46ac1540$d4043fc0$@com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00031.html

Bug-Description:

Overwriting a value in an associative array causes the memory allocated to
store the key on the second and subsequent assignments to leak.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/assoc.c	2009-08-05 20:19:40.000000000 -0400
--- ./assoc.c	2011-10-04 20:23:07.000000000 -0400
***************
*** 78,81 ****
--- 78,86 ----
    if (b == 0)
      return -1;
+   /* If we are overwriting an existing element's value, we're not going to
+      use the key.  Nothing in the array assignment code path frees the key
+      string, so we can free it here to avoid a memory leak. */
+   if (b->key != key)
+     free (key);
    FREE (b->data);
    b->data = value ? savestring (value) : (char *)0;
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- ./patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 10
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 11
  
  #endif /* _PATCHLEVEL_H_ */
+151 −0
Original line number Diff line number Diff line
			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-012

Bug-Reported-by:	Rui Santos <rsantos@grupopie.com>
Bug-Reference-ID:	<4E04C6D0.2020507@grupopie.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-06/msg00079.html

Bug-Description:

When calling the parser to recursively parse a command substitution within
an arithmetic expansion, the shell overwrote the saved shell input line and
associated state, resulting in a garbled command.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/parse.y	2011-02-26 19:19:05.000000000 -0500
--- ./parse.y	2011-06-24 20:08:22.000000000 -0400
***************
*** 3843,3846 ****
--- 3849,3853 ----
  {
    sh_parser_state_t ps;
+   sh_input_line_state_t ls;
    int orig_ind, nc, sflags;
    char *ret, *s, *ep, *ostring;
***************
*** 3850,3857 ****
--- 3857,3866 ----
    ostring = string;
  
+ /*itrace("xparse_dolparen: size = %d shell_input_line = `%s'", shell_input_line_size, shell_input_line);*/
    sflags = SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOFREE;
    if (flags & SX_NOLONGJMP)
      sflags |= SEVAL_NOLONGJMP;
    save_parser_state (&ps);
+   save_input_line_state (&ls);
  
    /*(*/
***************
*** 3862,3865 ****
--- 3871,3876 ----
    restore_parser_state (&ps);
    reset_parser ();
+   /* reset_parser clears shell_input_line and associated variables */
+   restore_input_line_state (&ls);
    if (interactive)
      token_to_read = 0;
***************
*** 5909,5912 ****
--- 5920,5929 ----
    ps->echo_input_at_read = echo_input_at_read;
  
+   ps->token = token;
+   ps->token_buffer_size = token_buffer_size;
+   /* Force reallocation on next call to read_token_word */
+   token = 0;
+   token_buffer_size = 0;
+ 
    return (ps);
  }
***************
*** 5950,5953 ****
--- 5967,6006 ----
    expand_aliases = ps->expand_aliases;
    echo_input_at_read = ps->echo_input_at_read;
+ 
+   FREE (token);
+   token = ps->token;
+   token_buffer_size = ps->token_buffer_size;
+ }
+ 
+ sh_input_line_state_t *
+ save_input_line_state (ls)
+      sh_input_line_state_t *ls;
+ {
+   if (ls == 0)
+     ls = (sh_input_line_state_t *)xmalloc (sizeof (sh_input_line_state_t));
+   if (ls == 0)
+     return ((sh_input_line_state_t *)NULL);
+ 
+   ls->input_line = shell_input_line;
+   ls->input_line_size = shell_input_line_size;
+   ls->input_line_len = shell_input_line_len;
+   ls->input_line_index = shell_input_line_index;
+ 
+   /* force reallocation */
+   shell_input_line = 0;
+   shell_input_line_size = shell_input_line_len = shell_input_line_index = 0;
+ }
+ 
+ void
+ restore_input_line_state (ls)
+      sh_input_line_state_t *ls;
+ {
+   FREE (shell_input_line);
+   shell_input_line = ls->input_line;
+   shell_input_line_size = ls->input_line_size;
+   shell_input_line_len = ls->input_line_len;
+   shell_input_line_index = ls->input_line_index;
+ 
+   set_line_mbstate ();
  }
  
*** ../bash-4.2-patched/shell.h	2011-01-06 22:16:55.000000000 -0500
--- ./shell.h	2011-06-24 19:12:25.000000000 -0400
***************
*** 137,140 ****
--- 139,145 ----
    int *token_state;
  
+   char *token;
+   int token_buffer_size;
+ 
    /* input line state -- line number saved elsewhere */
    int input_line_terminator;
***************
*** 167,171 ****
--- 172,186 ----
  } sh_parser_state_t;
  
+ typedef struct _sh_input_line_state_t {
+   char *input_line;
+   int input_line_index;
+   int input_line_size;
+   int input_line_len;
+ } sh_input_line_state_t;
+ 
  /* Let's try declaring these here. */
  extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *));
  extern void restore_parser_state __P((sh_parser_state_t *));
+ 
+ extern sh_input_line_state_t *save_input_line_state __P((sh_input_line_state_t *));
+ extern void restore_input_line_state __P((sh_input_line_state_t *));
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- ./patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 11
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 12
  
  #endif /* _PATCHLEVEL_H_ */
+52 −0
Original line number Diff line number Diff line
			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-013

Bug-Reported-by:	Marten Wikstrom <marten.wikstrom@keystream.se>
Bug-Reference-ID:	<BANLkTikKECAh94ZEX68iQvxYuPeEM_xoSQ@mail.gmail.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-05/msg00049.html

Bug-Description:

An off-by-one error caused the shell to skip over CTLNUL characters,
which are used internally to mark quoted null strings.  The effect
was to have stray 0x7f characters left after expanding words like
""""""""aa.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/subst.c	2011-03-06 14:11:11.000000000 -0500
--- ./subst.c	2011-05-11 11:23:33.000000000 -0400
***************
*** 3707,3711 ****
  	}
        else if (string[i] == CTLNUL)
! 	i++;
  
        prev_i = i;
--- 3710,3717 ----
  	}
        else if (string[i] == CTLNUL)
! 	{
! 	  i++;
! 	  continue;
! 	}
  
        prev_i = i;
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- ./patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 12
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 13
  
  #endif /* _PATCHLEVEL_H_ */
+47 −0
Original line number Diff line number Diff line
			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-014

Bug-Reported-by:	Shawn Bohrer <sbohrer@rgmadvisors.com>
Bug-Reference-ID:	<20110504152320.6E8F28130527@dev1.rgmadvisors.com>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-05/msg00018.html

Bug-Description:

The regular expression matching operator did not correctly match
expressions with an embedded ^A.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/pathexp.c	2010-08-13 23:21:57.000000000 -0400
--- ./pathexp.c	2011-05-05 16:40:58.000000000 -0400
***************
*** 197,201 ****
  	  if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
  	    continue;
! 	  if ((qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
  	    continue;
  	  temp[j++] = '\\';
--- 197,201 ----
  	  if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
  	    continue;
! 	  if (pathname[i+1] != CTLESC && (qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
  	    continue;
  	  temp[j++] = '\\';
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- ./patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 13
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 14
  
  #endif /* _PATCHLEVEL_H_ */
+81 −0
Original line number Diff line number Diff line
			     BASH PATCH REPORT
			     =================

Bash-Release:	4.2
Patch-ID:	bash42-015

Bug-Reported-by:	<dnade.ext@orange-ftgroup.com>
Bug-Reference-ID:	<728_1312188080_4E3666B0_728_118711_1_3B5D3E0F95CC5C478D6500CDCE8B691F7AAAA4AA3D@PUEXCB2B.nanterre.francetelecom.fr>
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-08/msg00000.html

Bug-Description:

When in a context where arithmetic evaluation is not taking place, the
evaluator should not check for division by 0.

Patch (apply with `patch -p0'):

*** ../bash-4.2-patched/expr.c	2010-12-21 11:12:13.000000000 -0500
--- ./expr.c	2011-08-02 20:58:28.000000000 -0400
***************
*** 477,480 ****
--- 481,492 ----
        if (special)
  	{
+ 	  if ((op == DIV || op == MOD) && value == 0)
+ 	    {
+ 	      if (noeval == 0)
+ 		evalerror (_("division by 0"));
+ 	      else
+ 	        value = 1;
+ 	    }
+ 
  	  switch (op)
  	    {
***************
*** 483,493 ****
  	      break;
  	    case DIV:
- 	      if (value == 0)
- 		evalerror (_("division by 0"));
  	      lvalue /= value;
  	      break;
  	    case MOD:
- 	      if (value == 0)
- 		evalerror (_("division by 0"));
  	      lvalue %= value;
  	      break;
--- 495,501 ----
***************
*** 805,809 ****
  
        if (((op == DIV) || (op == MOD)) && (val2 == 0))
! 	evalerror (_("division by 0"));
  
        if (op == MUL)
--- 813,822 ----
  
        if (((op == DIV) || (op == MOD)) && (val2 == 0))
! 	{
! 	  if (noeval == 0)
! 	    evalerror (_("division by 0"));
! 	  else
! 	    val2 = 1;
! 	}
  
        if (op == MUL)
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
--- ./patchlevel.h	Thu Feb 24 21:41:34 2011
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 14
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 15
  
  #endif /* _PATCHLEVEL_H_ */
Loading