]> git.pld-linux.org Git - packages/bash.git/blame - bash31-007
- official patches
[packages/bash.git] / bash31-007
CommitLineData
3516e50e
ER
1 BASH PATCH REPORT
2 =================
3
4Bash-Release: 3.1
5Patch-ID: bash31-007
6
7Bug-Reported-by: Tim Waugh <twaugh@redhat.com>, Laird Breyer <laird@lbreyer.com>
8Bug-Reference-ID: <20060105174434.GY16000@redhat.com>
9Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00009.html
10 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=347695
11
12Bug-Description:
13
14When the number of saved jobs exceeds the initial size of the jobs array
15(4096 slots), the array must be compacted and reallocated. An error in
16the code to do that could cause a segmentation fault.
17
18Patch:
19
20*** ../bash-3.1/jobs.c Fri Nov 11 23:13:27 2005
21--- jobs.c Wed Feb 1 13:55:38 2006
22***************
23*** 845,851 ****
24 {
25 sigset_t set, oset;
26! int nsize, i, j;
27 JOB **nlist;
28
29 nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
30 nsize *= JOB_SLOTS;
31--- 888,895 ----
32 {
33 sigset_t set, oset;
34! int nsize, i, j, ncur, nprev;
35 JOB **nlist;
36
37+ ncur = nprev = NO_JOB;
38 nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
39 nsize *= JOB_SLOTS;
40***************
41*** 855,869 ****
42
43 BLOCK_CHILD (set, oset);
44! nlist = (JOB **) xmalloc (nsize * sizeof (JOB *));
45 for (i = j = 0; i < js.j_jobslots; i++)
46 if (jobs[i])
47! nlist[j++] = jobs[i];
48
49 js.j_firstj = 0;
50! js.j_lastj = (j > 0) ? j - 1: 0;
51 js.j_jobslots = nsize;
52
53! free (jobs);
54! jobs = nlist;
55
56 UNBLOCK_CHILD (oset);
57--- 899,947 ----
58
59 BLOCK_CHILD (set, oset);
60! nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
61!
62 for (i = j = 0; i < js.j_jobslots; i++)
63 if (jobs[i])
64! {
65! if (i == js.j_current)
66! ncur = j;
67! if (i == js.j_previous)
68! nprev = j;
69! nlist[j++] = jobs[i];
70! }
71!
72! #if defined (DEBUG)
73! itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
74! itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
75! itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0);
76! #endif
77
78 js.j_firstj = 0;
79! js.j_lastj = (j > 0) ? j - 1 : 0;
80! js.j_njobs = j;
81 js.j_jobslots = nsize;
82
83! /* Zero out remaining slots in new jobs list */
84! for ( ; j < nsize; j++)
85! nlist[j] = (JOB *)NULL;
86!
87! if (jobs != nlist)
88! {
89! free (jobs);
90! jobs = nlist;
91! }
92!
93! if (ncur != NO_JOB)
94! js.j_current = ncur;
95! if (nprev != NO_JOB)
96! js.j_previous = nprev;
97!
98! /* Need to reset these */
99! if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
100! reset_current ();
101!
102! #ifdef DEBUG
103! itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
104! #endif
105
106 UNBLOCK_CHILD (oset);
107*** ../bash-3.1/patchlevel.h Wed Jul 20 13:58:20 2005
108--- patchlevel.h Wed Dec 7 13:48:42 2005
109***************
110*** 26,30 ****
111 looks for to find the patch level (for the sccs version string). */
112
113! #define PATCHLEVEL 6
114
115 #endif /* _PATCHLEVEL_H_ */
116--- 26,30 ----
117 looks for to find the patch level (for the sccs version string). */
118
119! #define PATCHLEVEL 7
120
121 #endif /* _PATCHLEVEL_H_ */
This page took 0.041601 seconds and 4 git commands to generate.