aboutsummaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-12-06 13:27:20 +0000
committerAndrew Burgess <aburgess@redhat.com>2024-03-25 18:31:38 +0000
commitf9ee45c3a95ac37cf1c3f4ac6be34b9a53e306f4 (patch)
tree68317009468f7447fe76531049e2a3ae18b261bf /bfd/dwarf2.c
parentec483c2344f967708cfa71c84ef349b6951c1374 (diff)
downloadgdb-f9ee45c3a95ac37cf1c3f4ac6be34b9a53e306f4.zip
gdb-f9ee45c3a95ac37cf1c3f4ac6be34b9a53e306f4.tar.gz
gdb-f9ee45c3a95ac37cf1c3f4ac6be34b9a53e306f4.tar.bz2
bfd: make _bfd_section_size_insane part of the public API
If a BFD user is making use of a function like bfd_get_section_contents to read a section into a pre-allocated buffer, then that BFD user might also want to make use of _bfd_section_size_insane prior to allocating the buffer they intend to use in order to validate that the buffer size that plan to allocate is sane. This commit makes _bfd_section_size_insane public, by renaming it to bfd_section_size_insane. I've updated the existing uses within bfd/, I don't believe this function is used outside of bfd/ currently. One place that I plan to make use of this function is in gdb/gdb_bfd.c, in the function gdb_bfd_get_full_section_contents. This change isn't included in this commit, but will come later if/when this has been merged into bfd. There should be no change in behaviour after this commit. bfd/ * bfd-in2.h (bfd_section_size_insane): Add declaration. * compress.c (bfd_get_full_section_contents): Update for new name of _bfd_section_size_insane. (bfd_init_section_compress_status): Likewise. * dwarf2.c (read_section): Likewise. (_bfd_dwarf2_slurp_debug_info): Likewise. * libbfd.h (_bfd_section_size_insane): Remove declaration. * section.c (_bfd_section_size_insane): Rename to ... (bfd_section_size_insane): ... this. binutils/ * readelf.c (uncompress_section_contents): Update comment to account for new name of _bfd_section_size_insane.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 5eda14e..2e87d18 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -716,7 +716,7 @@ read_section (bfd *abfd,
return false;
}
- if (_bfd_section_size_insane (abfd, msec))
+ if (bfd_section_size_insane (abfd, msec))
{
/* PR 26946 */
_bfd_error_handler (_("DWARF error: section %s is too big"),
@@ -5520,7 +5520,7 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd,
msec;
msec = find_debug_info (debug_bfd, debug_sections, msec))
{
- if (_bfd_section_size_insane (debug_bfd, msec))
+ if (bfd_section_size_insane (debug_bfd, msec))
goto restore_vma;
/* Catch PR25070 testcase overflowing size calculation here. */
if (total_size + msec->size < total_size)