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 | 18f8f63fb079b084323def219126836f23f5c2b4 (patch) | |
tree | 36a54cbfbc6a72621399e2cbc6923e1f11cc545a /src/Document.cxx | |
parent | 7b5476dae723cc94adeae1460c068aa686f4583b (diff) | |
download | scintilla-mirror-18f8f63fb079b084323def219126836f23f5c2b4.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++; |