[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
GitOrigin-RevId: 9b211a5076310f14081dd257b0cbac6857534bc3
diff --git a/src/UnwindCursor.hpp b/src/UnwindCursor.hpp
index 48902ea..03e21fb 100644
--- a/src/UnwindCursor.hpp
+++ b/src/UnwindCursor.hpp
@@ -1764,7 +1764,7 @@
(__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,