libelf may overflow data buffer when translating data to memory representation
If a section is of a size that is not a multiple of its section size, libelf may overflow the buffer allocated to hold the data.
(size / size-of-file-repr) * size-of-memory-repr
May be smaller than 'size' (thanks to integer division). It's considered invariant in libelf, that the size of the memory representation is always larger than or equal to the representation in a file, so we presume that allocating an amount of space equal to the above will always give us room to copy the entire section's data. It won't if the division has a remainder, even if the invariant otherwise holds.
Talking about this, briefly, with Robert, we think the right (or the least surprising, at least) thing for libelf to do is probably to allocate enough space for the whole section, thus proving all the data to the client (even the junk data).