[libunwind] Fix incorrect check for out-of-boundedness

If the personalityIndex (which is 0-based) is equal to the length of
the personality array, we should error out.

rdar://18013273
This commit is contained in:
Louis Dionne 2020-08-11 15:29:00 -04:00
parent b9c1bd39d0
commit 9b211a5076
1 changed files with 1 additions and 1 deletions

View File

@ -1764,7 +1764,7 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
(__builtin_ctz(UNWIND_PERSONALITY_MASK));
if (personalityIndex != 0) {
--personalityIndex; // change 1-based to zero-based index
if (personalityIndex > sectionHeader.personalityArrayCount()) {
if (personalityIndex >= sectionHeader.personalityArrayCount()) {
_LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with personality index %d, "
"but personality table has only %d entries",
encoding, personalityIndex,