rpms/gdb/F-10 gdb-bz505163-unbound-array-deref.patch, NONE, 1.1 gdb.spec, 1.312, 1.313

Jan Kratochvil jkratoch at fedoraproject.org
Thu Jun 11 21:31:19 UTC 2009


Author: jkratoch

Update of /cvs/pkgs/rpms/gdb/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3628

Modified Files:
	gdb.spec 
Added Files:
	gdb-bz505163-unbound-array-deref.patch 
Log Message:
* Thu Jun 11 2009 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-30
- Fix dereferencing unbound C arrays (BZ 505163).


gdb-bz505163-unbound-array-deref.patch:

--- NEW FILE gdb-bz505163-unbound-array-deref.patch ---
>From 30c13da4efe18f43ee34aa4b29bc86e1a53de548 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jkratoch at host1.dyn.jankratochvil.net>
Date: Thu, 11 Jun 2009 00:23:54 +0200
Subject: [PATCH] cherry-pick: Fix dereferencing unbound C arrays (RHBZ#505163).

gdb/
	* gdbtypes.c (get_discrete_bounds): Remove the VLA-introduced check for
	TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED and
	TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED.

gdb/testsuite/
	* gdb.base/arrayidx.c (unbound): New variable.
	* gdb.base/arrayidx.exp (p unbound.a == &unbound.a[0]): New test.
---
 gdb/gdbtypes.c                      |    3 ---
 gdb/testsuite/gdb.base/arrayidx.c   |    7 +++++++
 gdb/testsuite/gdb.base/arrayidx.exp |   10 +++++++++-
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 012485c..9899727 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -769,9 +769,6 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_RANGE:
-      if (TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (type) 
-	  || TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED (type))
-	return -1;
       *lowp = TYPE_LOW_BOUND (type);
       *highp = TYPE_HIGH_BOUND (type);
       return 1;
diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c
index 98d4d35..f98a656 100644
--- a/gdb/testsuite/gdb.base/arrayidx.c
+++ b/gdb/testsuite/gdb.base/arrayidx.c
@@ -17,6 +17,13 @@
 
 int array[] = {1, 2, 3, 4};
 
+#ifdef __GNUC__
+struct
+  {
+    int a[0];
+  } unbound;
+#endif
+
 int
 main (void)
 {
diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp
index 71ce4aa..af0e5f8 100644
--- a/gdb/testsuite/gdb.base/arrayidx.exp
+++ b/gdb/testsuite/gdb.base/arrayidx.exp
@@ -59,4 +59,12 @@ gdb_test "print array" \
          "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
          "Print array with array-indexes on"
 
-
+set test "p unbound.a == &unbound.a\[0\]"
+gdb_test_multiple $test $test {
+    -re " = 1\r\n$gdb_prompt $" {
+	pass $test
+    }
+    -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
+	unsupported "$test (no GCC)"
+    }
+}
-- 
1.6.0.6



Index: gdb.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/F-10/gdb.spec,v
retrieving revision 1.312
retrieving revision 1.313
diff -u -p -r1.312 -r1.313
--- gdb.spec	9 Nov 2008 15:22:32 -0000	1.312
+++ gdb.spec	11 Jun 2009 21:30:48 -0000	1.313
@@ -13,7 +13,7 @@ Version: 6.8
 
 # 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: 29%{?_with_upstream:.upstream}%{?dist}
+Release: 30%{?_with_upstream:.upstream}%{?dist}
 
 License: GPLv3+
 Group: Development/Debuggers
@@ -425,6 +425,9 @@ Patch343: gdb-6.8-watchpoint-conditional
 # Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
 Patch348: gdb-6.8-bz466901-backtrace-full-prelinked.patch
 
+# Fix dereferencing unbound C arrays (BZ 505163).
+Patch372: gdb-bz505163-unbound-array-deref.patch
+
 BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
 BuildRequires: flex bison sharutils expat-devel
 Requires: readline
@@ -629,6 +632,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 %patch342 -p1
 %patch343 -p1
 %patch348 -p1
+%patch372 -p1
 %patch124 -p1
 
 find -name "*.orig" | xargs rm -f
@@ -892,6 +896,9 @@ fi
 %endif
 
 %changelog
+* Thu Jun 11 2009 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-30
+- Fix dereferencing unbound C arrays (BZ 505163).
+
 * Sun Nov  9 2008 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-29
 - Fix more the variable-length-arrays support (BZ 468266, feature BZ 377541).
 - Integrate the `bt full' protection (for BZ 466901) into the VLA patch.




More information about the fedora-extras-commits mailing list