+ /* PR 23657. Check for invalid section size, in sections with contents.
+ Note - we do not set an error value here because the contents
+ of this particular section might not be needed by the consumer. */
+ if (dst->sh_type != SHT_NOBITS)
+ {
+ ufile_ptr filesize = bfd_get_file_size (abfd);
+
+ if (filesize != 0 && dst->sh_size > filesize)
+ _bfd_error_handler
+ (_("warning: %pB has a corrupt section with a size (%"
+ BFD_VMA_FMT "x) larger than the file size"),
+ abfd, dst->sh_size);
+ }