WIP MachO binutils port assisted by AI I may consider upstreaming this in the future.
0

Configure Feed

Select the types of activity you want to include in your feed.

buffer overflow in nds32_elf_lo12_reloc

nds32_elf_lo12_reloc reads the lo reloc word when processing stashed
hi relocs.

* elf32-nds32.c: Replace bfd_octets_per_byte with OCTETS_PER_BYTE
throughout file.
(nds32_elf_lo12_reloc): Sanity check reloc offset.

Alan Modra (May 26, 2026, 6:06 PM +0930) a8740b75 3ec37a19

+10 -4
+10 -4
bfd/elf32-nds32.c
··· 2697 2697 bfd_reloc_status_type status; 2698 2698 2699 2699 /* Sanity check the address (offset in section). */ 2700 - bfd_vma octet = offset * bfd_octets_per_byte (abfd, input_section); 2700 + bfd_vma octet = offset * OCTETS_PER_BYTE (abfd, input_section); 2701 2701 if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octet)) 2702 2702 return bfd_reloc_outofrange; 2703 2703 ··· 2821 2821 2822 2822 /* Sanity check the address (offset in section). */ 2823 2823 bfd_vma octet = (reloc_entry->address 2824 - * bfd_octets_per_byte (abfd, input_section)); 2824 + * OCTETS_PER_BYTE (abfd, input_section)); 2825 2825 if (!bfd_reloc_offset_in_range (reloc_entry->howto, 2826 2826 abfd, input_section, octet)) 2827 2827 return bfd_reloc_outofrange; ··· 2901 2901 return bfd_reloc_ok; 2902 2902 } 2903 2903 2904 + bfd_vma octet = (reloc_entry->address 2905 + * OCTETS_PER_BYTE (input_bfd, input_section)); 2906 + if (!bfd_reloc_offset_in_range (reloc_entry->howto, input_bfd, input_section, 2907 + octet)) 2908 + return bfd_reloc_outofrange; 2909 + 2904 2910 sdata = nds32_elf_section_data (input_section); 2905 2911 if (sdata->nds32_hi20_list != NULL) 2906 2912 { ··· 2992 2998 2993 2999 /* Sanity check the address (offset in section). */ 2994 3000 bfd_vma octet = (reloc_entry->address 2995 - * bfd_octets_per_byte (input_bfd, input_section)); 3001 + * OCTETS_PER_BYTE (input_bfd, input_section)); 2996 3002 if (!bfd_reloc_offset_in_range (reloc_entry->howto, input_bfd, input_section, 2997 3003 octet)) 2998 3004 return bfd_reloc_outofrange; ··· 4753 4759 bfd_vma relocation; 4754 4760 4755 4761 /* Sanity check the address. */ 4756 - bfd_vma octet = address * bfd_octets_per_byte (input_bfd, input_section); 4762 + bfd_vma octet = address * OCTETS_PER_BYTE (input_bfd, input_section); 4757 4763 if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, octet)) 4758 4764 return bfd_reloc_outofrange; 4759 4765