components/bash/patches/bash41-011.patch
author Stefan Teleman <stefan.teleman@oracle.com>
Wed, 24 Sep 2014 14:44:19 -0700
branchs11u2-sru-backport
changeset 3333 4af2ab639479
parent 927 19eda0ce91e0
permissions -rw-r--r--
19678459 problem in UTILITY/BASH
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
927
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     1
			     BASH PATCH REPORT
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     2
			     =================
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     3
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     4
Bash-Release:	4.1
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     5
Patch-ID:	bash41-011
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     6
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     7
Bug-Reported-by:	<[email protected]>
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     8
Bug-Reference-ID:	<[email protected]>
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     9
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00075.html
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    10
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    11
Bug-Description:
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    12
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    13
Under certain circumstances, running `fc -l' two times in succession with a
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    14
relative history offset at the end of the history will result in an incorrect
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    15
calculation of the last history entry and a seg fault.
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    16
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    17
Patch (apply with `patch -p0'):
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    18
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    19
*** ../bash-4.1-patched/builtins/fc.def	2009-03-21 14:03:43.000000000 -0400
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    20
--- builtins/fc.def	2011-04-19 15:46:17.000000000 -0400
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    21
***************
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    22
*** 304,307 ****
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    23
--- 304,317 ----
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    24
    last_hist = i - rh - hist_last_line_added;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    25
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    26
+   /* XXX */
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    27
+   if (i == last_hist && hlist[last_hist] == 0)
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    28
+     while (last_hist >= 0 && hlist[last_hist] == 0)
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    29
+       last_hist--;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    30
+   if (last_hist < 0)
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    31
+     {
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    32
+       sh_erange ((char *)NULL, _("history specification"));
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    33
+       return (EXECUTION_FAILURE);
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    34
+     }
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    35
+ 
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    36
    if (list)
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    37
      {
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    38
***************
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    39
*** 466,470 ****
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    40
  {
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    41
    int sign, n, clen, rh;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    42
!   register int i, j;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    43
    register char *s;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    44
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    45
--- 476,480 ----
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    46
  {
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    47
    int sign, n, clen, rh;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    48
!   register int i, j, last_hist;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    49
    register char *s;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    50
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    51
***************
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    52
*** 486,490 ****
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    53
       calculation as if it were on. */
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    54
    rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    55
!   i -= rh + hist_last_line_added;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    56
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    57
    /* No specification defaults to most recent command. */
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    58
--- 496,508 ----
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    59
       calculation as if it were on. */
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    60
    rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    61
!   last_hist = i - rh - hist_last_line_added;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    62
! 
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    63
!   if (i == last_hist && hlist[last_hist] == 0)
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    64
!     while (last_hist >= 0 && hlist[last_hist] == 0)
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    65
!       last_hist--;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    66
!   if (last_hist < 0)
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    67
!     return (-1);
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    68
! 
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    69
!   i = last_hist;
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    70
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    71
    /* No specification defaults to most recent command. */
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    72
*** ../bash-4.1-patched/patchlevel.h	2009-10-01 16:39:22.000000000 -0400
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    73
--- patchlevel.h	2010-01-14 09:38:08.000000000 -0500
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    74
***************
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    75
*** 26,30 ****
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    76
     looks for to find the patch level (for the sccs version string). */
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    77
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    78
! #define PATCHLEVEL 10
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    79
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    80
  #endif /* _PATCHLEVEL_H_ */
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    81
--- 26,30 ----
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    82
     looks for to find the patch level (for the sccs version string). */
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    83
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    84
! #define PATCHLEVEL 11
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    85
  
19eda0ce91e0 7186425 potential stack corruption in bash <= 4.2-033
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    86
  #endif /* _PATCHLEVEL_H_ */