aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMitchell Foral <unknown>2020-08-21 11:16:50 +1000
committerMitchell Foral <unknown>2020-08-21 11:16:50 +1000
commit686613bfcb7e52010734f6486b4472678d98c7fb (patch)
treeace62887e09551d8aa7d6ef35d5f5dd973c57c83 /src
parentda73d8db74271af998fa35dcedfeb781a0654de4 (diff)
downloadscintilla-mirror-686613bfcb7e52010734f6486b4472678d98c7fb.tar.gz
Backport: Bounds checks for setting annotation style.
Backport of changeset 8481:1594f3416bd6.
Diffstat (limited to 'src')
-rw-r--r--src/Document.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 8deec96d3..f4681a5ed 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -2369,10 +2369,12 @@ void Document::AnnotationSetText(Sci::Line line, const char *text) {
}
void Document::AnnotationSetStyle(Sci::Line line, int style) {
- Annotations()->SetStyle(line, style);
- const DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line),
- 0, 0, 0, line);
- NotifyModified(mh);
+ if (line >= 0 && line < LinesTotal()) {
+ Annotations()->SetStyle(line, style);
+ const DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line),
+ 0, 0, 0, line);
+ NotifyModified(mh);
+ }
}
void Document::AnnotationSetStyles(Sci::Line line, const unsigned char *styles) {
@@ -2409,10 +2411,12 @@ void Document::EOLAnnotationSetText(Sci::Line line, const char *text) {
}
void Document::EOLAnnotationSetStyle(Sci::Line line, int style) {
- EOLAnnotations()->SetStyle(line, style);
- const DocModification mh(SC_MOD_CHANGEEOLANNOTATION, LineStart(line),
- 0, 0, 0, line);
- NotifyModified(mh);
+ if (line >= 0 && line < LinesTotal()) {
+ EOLAnnotations()->SetStyle(line, style);
+ const DocModification mh(SC_MOD_CHANGEEOLANNOTATION, LineStart(line),
+ 0, 0, 0, line);
+ NotifyModified(mh);
+ }
}
void Document::EOLAnnotationClearAll() {