Fix detection of uncompressed .debug_str sections.

Resolves: #1082370
This commit is contained in:
Nick Clifton 2014-04-28 16:48:25 +01:00
parent 16b577d5e7
commit b1b97a35f2
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,30 @@
*** ../binutils-2.24.orig/bfd/compress.c 2014-04-28 16:35:20.429816317 +0100
--- bfd/compress.c 2014-04-28 16:36:06.450963028 +0100
***************
*** 25,30 ****
--- 25,31 ----
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
+ #include "safe-ctype.h"
#ifdef HAVE_ZLIB_H
static bfd_boolean
*************** bfd_is_section_compressed (bfd *abfd, se
*** 304,309 ****
--- 305,319 ----
compressed = (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)
&& CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"));
+ /* Check for the pathalogical case of a debug string section that
+ contains the string ZLIB.... as the first entry. We assume that
+ no uncompressed .debug_str section would ever be big enough to
+ have the first byte of its (big-endian) size be non-zero. */
+ if (compressed
+ && strcmp (sec->name, ".debug_str") == 0
+ && ISPRINT (compressed_buffer[4]))
+ compressed = FALSE;
+
/* Restore compress_status. */
sec->compress_status = saved;
return compressed;

View File

@ -17,7 +17,7 @@
Summary: A GNU collection of binary utilities Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug} Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.24 Version: 2.24
Release: 12%{?dist} Release: 13%{?dist}
License: GPLv3+ License: GPLv3+
Group: Development/Tools Group: Development/Tools
URL: http://sources.redhat.com/binutils URL: http://sources.redhat.com/binutils
@ -55,6 +55,8 @@ Patch15: binutils-2.24-elfnn-aarch64.patch
Patch16: binutils-2.24-DW_FORM_ref_addr.patch Patch16: binutils-2.24-DW_FORM_ref_addr.patch
# Fix compiling using gcc 4.9 # Fix compiling using gcc 4.9
Patch17: binutils-2.24-set-section-macros.patch Patch17: binutils-2.24-set-section-macros.patch
# Fix detections of uncompressed .debug_str sections that look like they have been compressed.
Patch18: binutils-2.24-fake-zlib-sections.patch
Provides: bundled(libiberty) Provides: bundled(libiberty)
@ -174,6 +176,7 @@ using libelf instead of BFD.
%patch15 -p0 -b .elf-aarch64~ %patch15 -p0 -b .elf-aarch64~
%patch16 -p0 -b .ref-addr~ %patch16 -p0 -b .ref-addr~
%patch17 -p0 -b .sec-macros~ %patch17 -p0 -b .sec-macros~
%patch18 -p0 -b .fake-zlib~
# We cannot run autotools as there is an exact requirement of autoconf-2.59. # We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -479,6 +482,9 @@ exit 0
%endif # %{isnative} %endif # %{isnative}
%changelog %changelog
* Mon Apr 28 2014 Nick Clifton <nickc@redhat.com> - 2.24-13
- Fix detection of uncompressed .debug_str sections. (#1082370)
* Tue Apr 22 2014 Nick Clifton <nickc@redhat.com> - 2.24-12 * Tue Apr 22 2014 Nick Clifton <nickc@redhat.com> - 2.24-12
- Fix compiling using gcc 4.9 (#1087374) - Fix compiling using gcc 4.9 (#1087374)