binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
binutils/bfd

Fix destination pointer advancement in RX big-endian section reads

Corrects out-of-bounds writes in big-endian RX executable section reads on unaligned offsets.

A bug in rx_get_section_contents for big-endian RX code sections caused incorrect destination pointer advancement when reading at unaligned offsets. The function advanced the pointer by the remaining byte count instead of the number of bytes actually consumed, leading to subsequent out-of-bounds writes during word-swapping. This fix ensures the pointer is advanced by the correct number of consumed bytes, preventing memory corruption, particularly during GDB target memory reads.

In Details

In bfd/elf32-rx.c, the rx_get_section_contents function's destination cursor cloc was incorrectly advanced by count (remaining bytes) instead of cnt (consumed bytes) after a partial copy. This commit corrects the advancement to cloc += cnt, preventing buffer overflows when processing unaligned section data on big-endian RX targets.

For Context
big-endian
A byte order where the most significant byte is stored at the lowest memory address. This is in contrast to little-endian, where the least significant byte is at the lowest address.
RX
Renesas RX, a family of 32-bit microcontrollers.
unaligned offset
An access to memory at an address that is not a multiple of the data's size (e.g., accessing a 4-byte integer at an address not divisible by 4). This can be less efficient or even cause errors on some architectures.
Filed Under: binutilsbfdrxendiannessgdb