diff options
author | Neil <nyamatongwe@gmail.com> | 2015-12-07 11:08:40 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2015-12-07 11:08:40 +1100 |
commit | 3c85e3a83b0d2f7da09b7b2573cb799842285ca7 (patch) | |
tree | 8256524808bc7f6d5cbe3601eb24cb4854da3c44 /src/Document.cxx | |
parent | bd5ac521d9b3d1330d2e1906dc96012b40a016da (diff) | |
download | scintilla-mirror-3c85e3a83b0d2f7da09b7b2573cb799842285ca7.tar.gz |
Prefer StyleIndexAt over StyleAt to avoid problems with out-of-bounds access for
styles > 0x7f.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
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<char>(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<char>(StyleAt(position)); + const int styAtPos = StyleIndexAt(position); if ((position > GetEndStyled()) || (styAtPos == styBrace)) { if (chAtPos == chBrace) depth++; |