aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-02-22 08:15:26 +1030
committerAlan Modra <amodra@gmail.com>2023-02-22 09:18:25 +1030
commitee590ebd33ad325dcef4e3656919ef5f9e04e52a (patch)
treee162dbb74e8fd602dc3531aeb1f056fe7fe63780 /bfd
parent3592bebbbf6b27732effc49bd6a73b0bd5af4df4 (diff)
downloadgdb-ee590ebd33ad325dcef4e3656919ef5f9e04e52a.zip
gdb-ee590ebd33ad325dcef4e3656919ef5f9e04e52a.tar.gz
gdb-ee590ebd33ad325dcef4e3656919ef5f9e04e52a.tar.bz2
debug_link duplicate file size checks
bfd_malloc_and_get_section does these checks. * opncls.c (bfd_get_debug_link_info_1): Don't check section size against file size. (bfd_get_alt_debug_link_info): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/opncls.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 5dacad9..cdf09b3 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -1195,7 +1195,6 @@ bfd_get_debug_link_info_1 (bfd *abfd, void *crc32_out)
unsigned int crc_offset;
char *name;
bfd_size_type size;
- ufile_ptr file_size;
BFD_ASSERT (abfd);
BFD_ASSERT (crc32_out);
@@ -1206,10 +1205,9 @@ bfd_get_debug_link_info_1 (bfd *abfd, void *crc32_out)
return NULL;
size = bfd_section_size (sect);
- file_size = bfd_get_size (abfd);
/* PR 22794: Make sure that the section has a reasonable size. */
- if (size < 8 || (file_size != 0 && size >= file_size))
+ if (size < 8)
return NULL;
if (!bfd_malloc_and_get_section (abfd, sect, &contents))
@@ -1284,7 +1282,6 @@ bfd_get_alt_debug_link_info (bfd * abfd, bfd_size_type *buildid_len,
unsigned int buildid_offset;
char *name;
bfd_size_type size;
- ufile_ptr file_size;
BFD_ASSERT (abfd);
BFD_ASSERT (buildid_len);
@@ -1296,8 +1293,7 @@ bfd_get_alt_debug_link_info (bfd * abfd, bfd_size_type *buildid_len,
return NULL;
size = bfd_section_size (sect);
- file_size = bfd_get_size (abfd);
- if (size < 8 || (file_size != 0 && size >= file_size))
+ if (size < 8)
return NULL;
if (!bfd_malloc_and_get_section (abfd, sect, & contents))