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/Editor.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/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 170f6a931..9c2703ab0 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -764,7 +764,7 @@ bool Editor::RangeContainsProtected(int start, int end) const { end = t; } for (int pos = start; pos < end; pos++) { - if (vs.styles[pdoc->StyleAt(pos)].IsProtected()) + if (vs.styles[pdoc->StyleIndexAt(pos)].IsProtected()) return true; } } @@ -4560,7 +4560,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b } bool Editor::PositionIsHotspot(int position) const { - return vs.styles[static_cast<unsigned char>(pdoc->StyleAt(position))].hotspot; + return vs.styles[pdoc->StyleIndexAt(position)].hotspot; } bool Editor::PointIsHotspot(Point pt) { @@ -4994,9 +4994,9 @@ void Editor::StyleToPositionInView(Position pos) { int endWindow = PositionAfterArea(GetClientDrawingRectangle()); if (pos > endWindow) pos = endWindow; - int styleAtEnd = pdoc->StyleAt(pos-1); + const int styleAtEnd = pdoc->StyleIndexAt(pos-1); pdoc->EnsureStyledTo(pos); - if ((endWindow > pos) && (styleAtEnd != pdoc->StyleAt(pos-1))) { + if ((endWindow > pos) && (styleAtEnd != pdoc->StyleIndexAt(pos-1))) { // Style at end of line changed so is multi-line change like starting a comment // so require rest of window to be styled. DiscardOverdraw(); // Prepared bitmaps may be invalid |