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