Skip to content

Commit 9b211a5

Browse files
committed
[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
1 parent b9c1bd3 commit 9b211a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libunwind/src/UnwindCursor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
17641764
(__builtin_ctz(UNWIND_PERSONALITY_MASK));
17651765
if (personalityIndex != 0) {
17661766
--personalityIndex; // change 1-based to zero-based index
1767-
if (personalityIndex > sectionHeader.personalityArrayCount()) {
1767+
if (personalityIndex >= sectionHeader.personalityArrayCount()) {
17681768
_LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with personality index %d, "
17691769
"but personality table has only %d entries",
17701770
encoding, personalityIndex,

0 commit comments

Comments
 (0)