mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
ubsan: integer overflow in section filepos subtraction
* elf.c (assign_file_positions_for_non_load_sections): Avoid signed integer overflow.
This commit is contained in:
parent
bb67763979
commit
aebb3d543d
@ -6289,8 +6289,7 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
|
||||
Elf_Internal_Shdr *hdr = &elf_section_data (sect)->this_hdr;
|
||||
if (hdr->sh_type != SHT_NOBITS)
|
||||
{
|
||||
p->p_filesz = (sect->filepos - m->sections[0]->filepos
|
||||
+ hdr->sh_size);
|
||||
p->p_filesz = sect->filepos - p->p_offset + hdr->sh_size;
|
||||
/* NB: p_memsz of the loadable PT_NOTE segment
|
||||
should be the same as p_filesz. */
|
||||
if (p->p_type == PT_NOTE
|
||||
|
Loading…
Reference in New Issue
Block a user