[patch] sanity check bfd_is_section_compressed header

Cary Coutant ccoutant@google.com
Wed Jun 5 20:40:00 GMT 2013


> Had a customer library where the first string in [non-compressed]
> .debug_str was "ZLIB_COMPRESS_ERROR".  The linker tried to allocate a
> few hundred terabytes to decompress it, because it *only* checks for
> "ZLIB" as the signature.  On ASCII systems, this sanity check assumes
> an uncompressed size greater than half a terabyte is unreasonable.  Is
> this a reasonable sanity check?  (if you answer "no" you get to come
> up with a better check ;)

Hmmm, the linker shouldn't even be looking for "ZLIB" unless the
section name is ".zdebug_str" (or, for the new gABI feature, unless
the SHF_COMPRESSED flag is set). Wouldn't that be a better check?

-cary



More information about the Binutils mailing list