BFD: Avoid use of uninitialized value in aarch64 core.
BFD now ignores rawsize in bfd_core to avoid using uninitialized values in AArch64 memory tag sections.
BFD was allocating excessive memory for AArch64 memory tag sections because it used the rawsize field to store the memory range, which is typically much larger than the actual data size. In some cases with fuzzed input, rawsize could be smaller than size, leading to uninitialized values being used. This commit fixes the issue by ignoring rawsize in bfd_core, preventing the allocation of excessive memory and the use of uninitialized data.
In Details
Commit d0ff5ca959df added PT_AARCH64_MEMTAG_MTE support, creating a section that stores "p_memsz" (memory range) in "rawsize" and "p_filesz" (file size) in "size". This could cause excessive memory allocation in BFD due to rawsize often being 32 times larger. This commit modifies bfd_get_section_limit_octets and bfd_get_section_alloc_size to ignore rawsize in bfd_core, preventing the issue.
For Context
When loading executable files, the Binary File Descriptor (BFD) library reads sections from the file into memory. The size of the memory allocated for a section is determined by its size in the file. This commit fixes an issue in how BFD handles AArch64 memory tag sections, where the allocated memory size was unnecessarily large, potentially leading to the use of uninitialized values or out-of-memory errors. The fix ensures that the correct amount of memory is allocated for these sections.