[lld-macho] Check if DWARF offset is too large for compact unwind
For functions that use DWARF encodings, their compact unwind entry will contain a hint about the offset of their DWARF entry from the start of the `__eh_frame` section. The encoding only has 3 bytes to encode this hint. Previously, I neglected to check for overflow (and didn't realize that the value was merely a hint without needing to be exact.) So for large `__eh_frame` sections, the hint would overflow and cause the compact unwind MODE flag to be corrupted, leading to uncaught exceptions at runtime. This diff fixes things by encoding zero as the hint for offsets that are too large. The unwinder will start a linear search at the hint location for the matching CFI record. The only requirement is that the hint points to a valid CFI record start, and the start of the section is always the start of a CFI record (in well-formed programs). I'm not adding a test for this because generating the test inputs takes a bit too much time. However, I...
parent
1b4021e6
Please register or sign in to comment