I found at least 2 possible situations when we may crash on large outputs:
Imagine we have large section sizes. It is simulated in a testcase by providing alignment of 0xFFFFFFFF for 32 bit target.
Then overflow may happen during assigning offsets.
Differential D25279
[ELF] - Do not crash on large output. Authored by grimar on Oct 5 2016, 7:22 AM.
Details
Diff Detail Event Timeline
Comment Actions I`ll try to update this tomorrow. Found that VA also may overflow in next assignAddresses(): template <class ELFT> void Writer<ELFT>::assignAddresses() {
uintX_t VA = Config->ImageBase + getHeaderSize<ELFT>();
...And VA affects on how we do calculate offsets.
| ||||||||||||||||||||||||||||||
This is I think just too much. We shouldn't introduce this integer-ish class just to check for overflow.