components/bash/patches/bash44-009.patch
author Vladimir Marek <Vladimir.Marek@oracle.com>
Thu, 26 Jan 2017 11:00:53 +0100
branchs11u3-sru
changeset 7629 ebccf6c8fbd4
permissions -rw-r--r--
25435207 Apply bash patches 6-11
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7629
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     1
			     BASH PATCH REPORT
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     2
			     =================
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     3
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     4
Bash-Release:	4.4
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     5
Patch-ID:	bash44-009
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     6
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     7
Bug-Reported-by:	Hong Cho <[email protected]>
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     8
Bug-Reference-ID:	<[email protected]>
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     9
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2016-12/msg00043.html
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    10
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    11
Bug-Description:
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    12
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    13
There is a race condition in add_history() that can be triggered by a fatal
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    14
signal arriving between the time the history length is updated and the time
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    15
the history list update is completed. A later attempt to reference an
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    16
invalid history entry can cause a crash.
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    17
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    18
Patch (apply with `patch -p0'):
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    19
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    20
*** ../bash-4.4-patched/lib/readline/history.c	2016-11-11 13:42:49.000000000 -0500
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    21
--- lib/readline/history.c	2016-12-05 10:37:51.000000000 -0500
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    22
***************
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    23
*** 280,283 ****
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    24
--- 280,284 ----
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    25
  {
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    26
    HIST_ENTRY *temp;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    27
+   int new_length;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    28
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    29
    if (history_stifled && (history_length == history_max_entries))
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    30
***************
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    31
*** 296,306 ****
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    32
        /* Copy the rest of the entries, moving down one slot.  Copy includes
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    33
  	 trailing NULL.  */
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    34
- #if 0
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    35
-       for (i = 0; i < history_length; i++)
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    36
- 	the_history[i] = the_history[i + 1];
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    37
- #else
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    38
        memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    39
- #endif
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    40
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    41
        history_base++;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    42
      }
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    43
--- 297,303 ----
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    44
        /* Copy the rest of the entries, moving down one slot.  Copy includes
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    45
  	 trailing NULL.  */
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    46
        memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    47
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    48
+       new_length = history_length;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    49
        history_base++;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    50
      }
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    51
***************
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    52
*** 316,320 ****
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    53
  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    54
  	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    55
! 	  history_length = 1;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    56
  	}
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    57
        else
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    58
--- 313,317 ----
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    59
  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    60
  	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    61
! 	  new_length = 1;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    62
  	}
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    63
        else
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    64
***************
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    65
*** 326,330 ****
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    66
  		xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    67
  	    }
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    68
! 	  history_length++;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    69
  	}
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    70
      }
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    71
--- 323,327 ----
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    72
  		xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    73
  	    }
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    74
! 	  new_length = history_length + 1;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    75
  	}
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    76
      }
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    77
***************
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    78
*** 332,337 ****
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    79
    temp = alloc_history_entry ((char *)string, hist_inittime ());
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    80
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    81
!   the_history[history_length] = (HIST_ENTRY *)NULL;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    82
!   the_history[history_length - 1] = temp;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    83
  }
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    84
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    85
--- 329,335 ----
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    86
    temp = alloc_history_entry ((char *)string, hist_inittime ());
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    87
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    88
!   the_history[new_length] = (HIST_ENTRY *)NULL;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    89
!   the_history[new_length - 1] = temp;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    90
!   history_length = new_length;
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    91
  }
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    92
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    93
*** ../bash-4.4/patchlevel.h	2016-06-22 14:51:03.000000000 -0400
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    94
--- patchlevel.h	2016-10-01 11:01:28.000000000 -0400
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    95
***************
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    96
*** 26,30 ****
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    97
     looks for to find the patch level (for the sccs version string). */
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    98
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    99
! #define PATCHLEVEL 8
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   100
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   101
  #endif /* _PATCHLEVEL_H_ */
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   102
--- 26,30 ----
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   103
     looks for to find the patch level (for the sccs version string). */
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   104
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   105
! #define PATCHLEVEL 9
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   106
  
ebccf6c8fbd4 25435207 Apply bash patches 6-11
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   107
  #endif /* _PATCHLEVEL_H_ */