[gdb/f14/master] - Fix occasional NULL dereference of the readline-6.0 workaround (BZ 575516).

Jan Kratochvil jankratochvil at fedoraproject.org
Sun Jan 16 18:17:31 UTC 2011


commit 9d05126f6448df1e7a8fdaa445a232fd72259e96
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Sun Jan 16 19:17:18 2011 +0100

    - Fix occasional NULL dereference of the readline-6.0 workaround (BZ 575516).

 gdb-readline-6.0-signal.patch |   35 ++++++++++++++++++++++++-----------
 gdb.spec                      |    5 ++++-
 2 files changed, 28 insertions(+), 12 deletions(-)
---
diff --git a/gdb-readline-6.0-signal.patch b/gdb-readline-6.0-signal.patch
index 35c29fb..329b7dc 100644
--- a/gdb-readline-6.0-signal.patch
+++ b/gdb-readline-6.0-signal.patch
@@ -67,8 +67,8 @@ gdb/testsuite/
 
 Index: gdb-7.2/gdb/config.in
 ===================================================================
---- gdb-7.2.orig/gdb/config.in	2011-01-16 18:26:11.000000000 +0100
-+++ gdb-7.2/gdb/config.in	2011-01-16 18:26:50.000000000 +0100
+--- gdb-7.2.orig/gdb/config.in	2011-01-16 19:04:55.000000000 +0100
++++ gdb-7.2/gdb/config.in	2011-01-16 19:05:01.000000000 +0100
 @@ -463,6 +463,9 @@
  /* Define to 1 if wcwidth is declared even after undefining macros. */
  #undef HAVE_RAW_DECL_WCWIDTH
@@ -81,8 +81,8 @@ Index: gdb-7.2/gdb/config.in
  
 Index: gdb-7.2/gdb/configure.ac
 ===================================================================
---- gdb-7.2.orig/gdb/configure.ac	2011-01-16 18:26:11.000000000 +0100
-+++ gdb-7.2/gdb/configure.ac	2011-01-16 18:26:26.000000000 +0100
+--- gdb-7.2.orig/gdb/configure.ac	2011-01-16 19:04:57.000000000 +0100
++++ gdb-7.2/gdb/configure.ac	2011-01-16 19:05:01.000000000 +0100
 @@ -779,17 +779,25 @@ if test "$with_system_readline" = yes; t
    # readline-6.0 started to use the name `_rl_echoing_p'.
    # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
@@ -114,7 +114,7 @@ Index: gdb-7.2/gdb/configure.ac
 Index: gdb-7.2/gdb/event-loop.c
 ===================================================================
 --- gdb-7.2.orig/gdb/event-loop.c	2010-05-25 17:48:43.000000000 +0200
-+++ gdb-7.2/gdb/event-loop.c	2011-01-16 18:27:14.000000000 +0100
++++ gdb-7.2/gdb/event-loop.c	2011-01-16 19:13:31.000000000 +0100
 @@ -37,6 +37,7 @@
  #include "exceptions.h"
  #include "gdb_assert.h"
@@ -133,7 +133,7 @@ Index: gdb-7.2/gdb/event-loop.c
  
    /* Any events already waiting in the queue?  */
    if (process_event ())
-@@ -460,6 +464,16 @@ gdb_do_one_event (void *data)
+@@ -460,6 +464,29 @@ gdb_do_one_event (void *data)
    if (gdb_wait_for_event (1) < 0)
      return -1;
  
@@ -141,9 +141,22 @@ Index: gdb-7.2/gdb/event-loop.c
 +  if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
 +      && _rl_caught_signal)
 +    {
++      char *prompt;
++
++      if (rl_prompt == NULL)
++	{
++	  /* Should not happen, defensive only.  */
++	  prompt = "";
++	}
++      else
++	{
++	  prompt = alloca (strlen (rl_prompt) + 1);
++	  strcpy (prompt, rl_prompt);
++	}
++
 +      /* Call RL_CHECK_SIGNALS this way.  */
 +      rl_callback_handler_remove ();
-+      rl_callback_handler_install (NULL, input_handler);
++      rl_callback_handler_install (prompt, input_handler);
 +    }
 +#endif
 +
@@ -152,8 +165,8 @@ Index: gdb-7.2/gdb/event-loop.c
      return 1;
 Index: gdb-7.2/gdb/testsuite/gdb.gdb/selftest.exp
 ===================================================================
---- gdb-7.2.orig/gdb/testsuite/gdb.gdb/selftest.exp	2011-01-16 18:26:08.000000000 +0100
-+++ gdb-7.2/gdb/testsuite/gdb.gdb/selftest.exp	2011-01-16 18:30:41.000000000 +0100
+--- gdb-7.2.orig/gdb/testsuite/gdb.gdb/selftest.exp	2011-01-16 19:04:55.000000000 +0100
++++ gdb-7.2/gdb/testsuite/gdb.gdb/selftest.exp	2011-01-16 19:05:01.000000000 +0100
 @@ -433,6 +433,28 @@ proc test_with_self { executable } {
  	}
      }
@@ -199,8 +212,8 @@ Index: gdb-7.2/gdb/testsuite/gdb.gdb/selftest.exp
  	-re ".*$gdb_prompt $" {
 Index: gdb-7.2/gdb/configure
 ===================================================================
---- gdb-7.2.orig/gdb/configure	2011-01-16 18:26:11.000000000 +0100
-+++ gdb-7.2/gdb/configure	2011-01-16 18:26:51.000000000 +0100
+--- gdb-7.2.orig/gdb/configure	2011-01-16 19:04:57.000000000 +0100
++++ gdb-7.2/gdb/configure	2011-01-16 19:05:01.000000000 +0100
 @@ -10305,10 +10305,10 @@ if test "$with_system_readline" = yes; t
    # readline-6.0 started to use the name `_rl_echoing_p'.
    # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
diff --git a/gdb.spec b/gdb.spec
index 6171c88..1495e8f 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -27,7 +27,7 @@ Version: 7.2
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 35%{?_with_upstream:.upstream}%{dist}
+Release: 36%{?_with_upstream:.upstream}%{dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain
 Group: Development/Debuggers
@@ -1401,6 +1401,9 @@ fi
 %endif
 
 %changelog
+* Sun Jan 16 2011 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.2-36.fc14
+- Fix occasional NULL dereference of the readline-6.0 workaround (BZ 575516).
+
 * Sun Jan 16 2011 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.2-35.fc14
 - Fix callback-mode readline-6.0 regression for CTRL-C (for RHEL-6.0).
 


More information about the scm-commits mailing list