[PATCH] D25467: [ELF] - Alternative fix to prevent possible crash on large output.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 11:46:54 PDT 2016


ruiu added a comment.

Here's my proposal to detect offset overflow without checking integer overflow everywhere.

- Use uint64_t for Off instead of uintX_t everywhere
- If the final Off is greater than sizeof(uintX_t), reject it. This check should suffice for detecting any overflow on 32-bit targets.
- Reject insanely large sections and alignments such as >2^40 when reading a file. This suffices to prevent any overflow on 64-bit targets.

That being said, I doubt this is a top priority thing to do.


https://reviews.llvm.org/D25467





More information about the llvm-commits mailing list