checked in (request 37741)
OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=35
This commit is contained in:
parent
26420780dc
commit
5493c20b10
@ -1,18 +0,0 @@
|
|||||||
Andreas Schwab <schwab@linux-m68k.org> writes:
|
|
||||||
|
|
||||||
> $ declare -A a=b; unset a
|
|
||||||
> *** glibc detected *** /bin/bash: free(): invalid pointer: 0x10091644 ***
|
|
||||||
|
|
||||||
And the obvious patch:
|
|
||||||
|
|
||||||
--- builtins/declare.def
|
|
||||||
+++ builtins/declare.def 2010-04-09 17:20:51.000000000 +0000
|
|
||||||
@@ -512,7 +512,7 @@ declare_internal (list, local_var)
|
|
||||||
{
|
|
||||||
/* let bind_{array,assoc}_variable take care of this. */
|
|
||||||
if (assoc_p (var))
|
|
||||||
- bind_assoc_variable (var, name, "0", value, aflags);
|
|
||||||
+ bind_assoc_variable (var, name, savestring ("0"), value, aflags);
|
|
||||||
else
|
|
||||||
bind_array_variable (name, 0, value, aflags);
|
|
||||||
}
|
|
@ -14,3 +14,145 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
--- xmalloc.c
|
||||||
|
+++ xmalloc.c 2010-02-24 08:32:51.452626384 +0000
|
||||||
|
@@ -35,6 +35,11 @@
|
||||||
|
# include "ansi_stdlib.h"
|
||||||
|
#endif /* HAVE_STDLIB_H */
|
||||||
|
|
||||||
|
+/* Determine which kind of system this is. */
|
||||||
|
+#include <signal.h>
|
||||||
|
+extern int interrupt_immediately;
|
||||||
|
+extern int signal_is_trapped __P((int));
|
||||||
|
+
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "bashintl.h"
|
||||||
|
@@ -94,6 +99,34 @@ allocerr (func, bytes)
|
||||||
|
#endif /* !HAVE_SBRK */
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+block_signals (setp, osetp)
|
||||||
|
+ sigset_t *setp, *osetp;
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_POSIX_SIGNALS
|
||||||
|
+ sigfillset (setp);
|
||||||
|
+ sigemptyset (osetp);
|
||||||
|
+ sigprocmask (SIG_BLOCK, setp, osetp);
|
||||||
|
+#else
|
||||||
|
+# if defined (HAVE_BSD_SIGNALS)
|
||||||
|
+ *osetp = sigsetmask (-1);
|
||||||
|
+# endif
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+unblock_signals (setp, osetp)
|
||||||
|
+ sigset_t *setp, *osetp;
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_POSIX_SIGNALS
|
||||||
|
+ sigprocmask (SIG_SETMASK, osetp, (sigset_t *)NULL);
|
||||||
|
+#else
|
||||||
|
+# if defined (HAVE_BSD_SIGNALS)
|
||||||
|
+ sigsetmask (*osetp);
|
||||||
|
+# endif
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Return a pointer to free()able block of memory large enough
|
||||||
|
to hold BYTES number of bytes. If the memory cannot be allocated,
|
||||||
|
print an error message and abort. */
|
||||||
|
@@ -102,15 +135,28 @@ xmalloc (bytes)
|
||||||
|
size_t bytes;
|
||||||
|
{
|
||||||
|
PTR_T temp;
|
||||||
|
+ sigset_t set, oset;
|
||||||
|
+ int blocked_sigs;
|
||||||
|
|
||||||
|
#if defined (DEBUG)
|
||||||
|
if (bytes == 0)
|
||||||
|
internal_warning("xmalloc: size argument is 0");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+ /* Block all signals in case we are executed from a signal handler. */
|
||||||
|
+ blocked_sigs = 0;
|
||||||
|
+ if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
|
||||||
|
+ {
|
||||||
|
+ block_signals (&set, &oset);
|
||||||
|
+ blocked_sigs = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
FINDBRK();
|
||||||
|
temp = malloc (bytes);
|
||||||
|
|
||||||
|
+ if (blocked_sigs)
|
||||||
|
+ unblock_signals (&set, &oset);
|
||||||
|
+
|
||||||
|
if (temp == 0)
|
||||||
|
allocerr ("xmalloc", bytes);
|
||||||
|
|
||||||
|
@@ -123,15 +169,28 @@ xrealloc (pointer, bytes)
|
||||||
|
size_t bytes;
|
||||||
|
{
|
||||||
|
PTR_T temp;
|
||||||
|
+ sigset_t set, oset;
|
||||||
|
+ int blocked_sigs;
|
||||||
|
|
||||||
|
#if defined (DEBUG)
|
||||||
|
if (bytes == 0)
|
||||||
|
internal_warning("xrealloc: size argument is 0");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+ /* Block all signals in case we are executed from a signal handler. */
|
||||||
|
+ blocked_sigs = 0;
|
||||||
|
+ if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
|
||||||
|
+ {
|
||||||
|
+ block_signals (&set, &oset);
|
||||||
|
+ blocked_sigs = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
FINDBRK();
|
||||||
|
temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
|
||||||
|
|
||||||
|
+ if (blocked_sigs)
|
||||||
|
+ unblock_signals (&set, &oset);
|
||||||
|
+
|
||||||
|
if (temp == 0)
|
||||||
|
allocerr ("xrealloc", bytes);
|
||||||
|
|
||||||
|
@@ -145,7 +204,22 @@ xfree (string)
|
||||||
|
PTR_T string;
|
||||||
|
{
|
||||||
|
if (string)
|
||||||
|
- free (string);
|
||||||
|
+ {
|
||||||
|
+ sigset_t set, oset;
|
||||||
|
+ int blocked_sigs = 0;
|
||||||
|
+
|
||||||
|
+ /* Block all signals in case we are executed from a signal handler. */
|
||||||
|
+ if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
|
||||||
|
+ {
|
||||||
|
+ block_signals (&set, &oset);
|
||||||
|
+ blocked_sigs = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free (string);
|
||||||
|
+
|
||||||
|
+ if (blocked_sigs)
|
||||||
|
+ unblock_signals (&set, &oset);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USING_BASH_MALLOC
|
||||||
|
--- builtins/read.def
|
||||||
|
+++ builtins/read.def 2010-03-02 16:24:59.070362886 +0000
|
||||||
|
@@ -387,6 +387,8 @@ read_builtin (list)
|
||||||
|
input_string. We want to run all the rest and use input_string,
|
||||||
|
so we have to remove it from the stack. */
|
||||||
|
remove_unwind_protect ();
|
||||||
|
+ interrupt_immediately--;
|
||||||
|
+ terminate_immediately = 0;
|
||||||
|
run_unwind_frame ("read_builtin");
|
||||||
|
input_string[i] = '\0'; /* make sure it's terminated */
|
||||||
|
retval = 128+SIGALRM;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:73424968769484ed4ac52f07dbe882c9710faf8a348c0fffe57d64bbde8ad898
|
oid sha256:04b5bbbf7fd0560da491e1a7610daea5ffc06a2df0b028fce25bd75d8d6c34e0
|
||||||
size 2814
|
size 1506
|
||||||
|
21
bash.changes
21
bash.changes
@ -1,24 +1,3 @@
|
|||||||
-------------------------------------------------------------------
|
|
||||||
Mon Apr 12 11:36:30 CEST 2010 - werner@suse.de
|
|
||||||
|
|
||||||
- Add fix for memory double free in array handling
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Tue Apr 6 15:27:24 CEST 2010 - werner@suse.de
|
|
||||||
|
|
||||||
- Update bash 4.1 to patch level 5 (related to bnc#522351)
|
|
||||||
* If command completion is attempted on a word with a quoted globbing
|
|
||||||
character (e.g., `*' or `?'), bash can reference a NULL pointer and
|
|
||||||
dump core.
|
|
||||||
* When running in Posix mode and executing a shell function without local
|
|
||||||
variables, bash will not propagate a variable in a special builtin's temporary
|
|
||||||
environment to have global scope.
|
|
||||||
* When the `read' builtin times out after the timeout specified with -t is
|
|
||||||
exceeded, it does not reset the flags that tell signal handlers to process
|
|
||||||
signals immediately instead of deferring their handling. This can result
|
|
||||||
in unsafe functions being called from signal handlers, which can cause bash
|
|
||||||
to hang or dump core.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Mar 9 15:34:05 CET 2010 - werner@suse.de
|
Tue Mar 9 15:34:05 CET 2010 - werner@suse.de
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ Patch30: readline-6.1-destdir.patch
|
|||||||
Patch40: bash-4.1-bash.bashrc.dif
|
Patch40: bash-4.1-bash.bashrc.dif
|
||||||
Patch41: bash-4.1-intr.dif
|
Patch41: bash-4.1-intr.dif
|
||||||
Patch42: bash-4.1-non_void.patch
|
Patch42: bash-4.1-non_void.patch
|
||||||
Patch43: bash-4.1-array.dif
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
%global _sysconfdir /etc
|
%global _sysconfdir /etc
|
||||||
%global _incdir %{_includedir}
|
%global _incdir %{_includedir}
|
||||||
@ -311,7 +310,6 @@ unset p
|
|||||||
%patch40 -p0 -b .bashrc
|
%patch40 -p0 -b .bashrc
|
||||||
%patch41 -p0 -b .intr
|
%patch41 -p0 -b .intr
|
||||||
%patch42 -p0 -b .non_void
|
%patch42 -p0 -b .non_void
|
||||||
%patch43 -p0 -b .array
|
|
||||||
%patch0 -p0
|
%patch0 -p0
|
||||||
cd ../readline-%{rl_vers}
|
cd ../readline-%{rl_vers}
|
||||||
for p in ../readline-%{rl_vers}-patches/*; do
|
for p in ../readline-%{rl_vers}-patches/*; do
|
||||||
|
Loading…
Reference in New Issue
Block a user