diff options
author | Alan Modra <amodra@gmail.com> | 2022-01-01 13:53:06 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-01-01 14:22:13 +1030 |
commit | fcec5debef3f23dd0024a4501609353676d7dc50 (patch) | |
tree | 7413e5b153d4fef9ca63c21f01cfd6dbd0d2a6b2 /bfd/mach-o.c | |
parent | 487b0ff02ddafeb27641c7674d4c8b3c9f62c6c3 (diff) | |
download | gdb-fcec5debef3f23dd0024a4501609353676d7dc50.zip gdb-fcec5debef3f23dd0024a4501609353676d7dc50.tar.gz gdb-fcec5debef3f23dd0024a4501609353676d7dc50.tar.bz2 |
ubsan: bfd_mach_o_build_commands shift exponent 64 is too large
* mach-o.c (bfd_mach_o_read_section_32): Limit alignment further.
(bfd_mach_o_read_section_64): Likewise.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r-- | bfd/mach-o.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c index d90ea3c..af5ce02 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -3653,12 +3653,12 @@ bfd_mach_o_read_section_32 (bfd *abfd, unsigned long prot) section->offset = bfd_h_get_32 (abfd, raw.offset); section->align = bfd_h_get_32 (abfd, raw.align); /* PR 17512: file: 0017eb76. */ - if (section->align > 64) + if (section->align >= 31) { _bfd_error_handler - (_("bfd_mach_o_read_section_32: overlarge alignment value: %#lx, " - "using 32 instead"), section->align); - section->align = 32; + (_("bfd_mach_o_read_section_32: overlarge alignment value: %#lx"), + section->align); + section->align = 30; } section->reloff = bfd_h_get_32 (abfd, raw.reloff); section->nreloc = bfd_h_get_32 (abfd, raw.nreloc); @@ -3696,12 +3696,12 @@ bfd_mach_o_read_section_64 (bfd *abfd, unsigned long prot) section->size = bfd_h_get_64 (abfd, raw.size); section->offset = bfd_h_get_32 (abfd, raw.offset); section->align = bfd_h_get_32 (abfd, raw.align); - if (section->align > 64) + if (section->align >= 63) { _bfd_error_handler - (_("bfd_mach_o_read_section_64: overlarge alignment value: %#lx, " - "using 32 instead"), section->align); - section->align = 32; + (_("bfd_mach_o_read_section_64: overlarge alignment value: %#lx"), + section->align); + section->align = 62; } section->reloff = bfd_h_get_32 (abfd, raw.reloff); section->nreloc = bfd_h_get_32 (abfd, raw.nreloc); |