From 3c85e3a83b0d2f7da09b7b2573cb799842285ca7 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 7 Dec 2015 11:08:40 +1100 Subject: Prefer StyleIndexAt over StyleAt to avoid problems with out-of-bounds access for styles > 0x7f. --- src/Document.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Document.cxx') diff --git a/src/Document.cxx b/src/Document.cxx index 122ce0f59..b0744a21c 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2215,7 +2215,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) { char chSeek = BraceOpposite(chBrace); if (chSeek == '\0') return - 1; - char styBrace = static_cast(StyleAt(position)); + const int styBrace = StyleIndexAt(position); int direction = -1; if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') direction = 1; @@ -2223,7 +2223,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) { position = NextPosition(position, direction); while ((position >= 0) && (position < Length())) { char chAtPos = CharAt(position); - char styAtPos = static_cast(StyleAt(position)); + const int styAtPos = StyleIndexAt(position); if ((position > GetEndStyled()) || (styAtPos == styBrace)) { if (chAtPos == chBrace) depth++; -- cgit v1.2.3