public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: Fix possible NULL crash in find_charset_names (Trom Tromey, BZ 786091).
Date: Sat, 27 Jun 2026 23:55:22 GMT	[thread overview]
Message-ID: <178260452259.1.15684102287130646468.rpms-gdb-a50d5b63a7ca@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/gdb
            Branch : gdb-17.2-rebase-f44
            Commit : a50d5b63a7ca7266dd5a18242fde8964ff6754c2
            Author : Jan Kratochvil <jan.kratochvil@redhat.com>
            Date   : 2012-02-09T20:09:41+01:00
            Stats  : +104/-3 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/gdb/c/a50d5b63a7ca7266dd5a18242fde8964ff6754c2?branch=gdb-17.2-rebase-f44

            Log:
            Fix possible NULL crash in find_charset_names (Trom Tromey, BZ 786091).

- [ppc*] Fix build failure due to GCC aliasing warning (BZ 786504).

---
diff --git a/gdb-upstream.patch b/gdb-upstream.patch
new file mode 100644
index 0000000..0ac15d7
--- /dev/null
+++ b/gdb-upstream.patch
@@ -0,0 +1,97 @@
+FYI: fix possible crash in find_charset_names
+http://sourceware.org/ml/gdb-patches/2012-02/msg00073.html
+http://sourceware.org/ml/gdb-cvs/2012-02/msg00037.html
+https://bugzilla.redhat.com/show_bug.cgi?id=786091
+
+### src/gdb/ChangeLog	2012/02/07 04:48:14	1.13810
+### src/gdb/ChangeLog	2012/02/07 15:42:33	1.13811
+## -1,3 +1,7 @@
++2012-02-07  Tom Tromey  <tromey@redhat.com>
++
++	* charset.c (find_charset_names): Check 'in' against NULL.
++
+ 2012-02-06  Doug Evans  <dje@google.com>
+ 
+ 	* gdbtypes.h (struct main_type): Change type of name,tag_name,
+--- src/gdb/charset.c	2012/01/24 21:36:37	1.47
++++ src/gdb/charset.c	2012/02/07 15:42:39	1.48
+@@ -839,7 +839,7 @@
+ 	 parse the glibc and libiconv formats; feel free to add others
+ 	 as needed.  */
+ 
+-      while (!feof (in))
++      while (in != NULL && !feof (in))
+ 	{
+ 	  /* The size of buf is chosen arbitrarily.  */
+ 	  char buf[1024];
+
+
+
+http://sourceware.org/ml/gdb-patches/2012-02/msg00151.html
+Subject: [patch] ppc-linux-nat.c: Fix gcc-4.7 aliasing warnings
+
+Hi,
+
+ppc-linux-nat.c: In function 'fetch_register':
+ppc-linux-nat.c:598:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
+ppc-linux-nat.c: In function 'store_register':
+ppc-linux-nat.c:1078:8: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
+
+gcc-4.7.0-0.10.fc17.ppc64
+
+Probably clear, I looked at making it using union instead of memcpy but that
+would be too ugly.
+
+No regressions on ppc64-fedorarawhide-linux-gnu only for gdb.base/*.exp.
+
+I will check it in.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2012-02-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* ppc-linux-nat.c (fetch_register, store_register): Fix GCC aliasing
+	compilation warning.
+
+--- a/gdb/ppc-linux-nat.c
++++ b/gdb/ppc-linux-nat.c
+@@ -593,9 +593,10 @@ fetch_register (struct regcache *regcache, int tid, int regno)
+        bytes_transferred < register_size (gdbarch, regno);
+        bytes_transferred += sizeof (long))
+     {
++      long l;
++
+       errno = 0;
+-      *(long *) &buf[bytes_transferred]
+-        = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
++      l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
+       regaddr += sizeof (long);
+       if (errno != 0)
+ 	{
+@@ -604,6 +605,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
+ 		   gdbarch_register_name (gdbarch, regno), regno);
+ 	  perror_with_name (message);
+ 	}
++      memcpy (&buf[bytes_transferred], &l, sizeof (l));
+     }
+ 
+   /* Now supply the register.  Keep in mind that the regcache's idea
+@@ -1073,9 +1075,11 @@ store_register (const struct regcache *regcache, int tid, int regno)
+ 
+   for (i = 0; i < bytes_to_transfer; i += sizeof (long))
+     {
++      long l;
++
++      memcpy (&l, &buf[i], sizeof (l));
+       errno = 0;
+-      ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr,
+-	      *(long *) &buf[i]);
++      ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
+       regaddr += sizeof (long);
+ 
+       if (errno == EIO 
+

diff --git a/gdb.spec b/gdb.spec
index c363f83..9683f85 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -28,7 +28,7 @@ Version: 7.4.50.%{snap}
 
 # 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: 10%{?_with_upstream:.upstream}%{?dist}
+Release: 11%{?_with_upstream:.upstream}%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
 Group: Development/Debuggers
@@ -257,7 +257,7 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
 
 # Backported fixups post the source tarball.
 #Xdrop: Just backports.
-#Patch232: gdb-upstream.patch
+Patch232: gdb-upstream.patch
 
 # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
 #=fedoratest+ppc
@@ -694,7 +694,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 
 %if 0%{!?_with_upstream:1}
 
-#patch232 -p1
+%patch232 -p1
 %patch349 -p1
 %patch1 -p1
 %patch3 -p1
@@ -1232,6 +1232,10 @@ fi
 %{_infodir}/gdb.info*
 
 %changelog
+* Thu Feb  9 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-11.fc17
+- Fix possible NULL crash in find_charset_names (Trom Tromey, BZ 786091).
+- [ppc*] Fix build failure due to GCC aliasing warning (BZ 786504).
+
 * Sat Jan 21 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-10.fc17
 - Rebase to FSF GDB 7.4.50.20120120.
 - Drop the g77 .spec provisioning as it has been fixed in FSF GDB.

                 reply	other threads:[~2026-06-27 23:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178260452259.1.15684102287130646468.rpms-gdb-a50d5b63a7ca@fedoraproject.org \
    --to=jan.kratochvil@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox