diff options
author | nyamatongwe <devnull@localhost> | 2011-10-23 10:36:32 +1100 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-10-23 10:36:32 +1100 |
commit | 576adef9a5df55d74e2730dc3ffb5db9f0a0a3f2 (patch) | |
tree | b3ddf6caa188ea4c636a7e6462db6af7b0a44c65 | |
parent | af10c645f12c3924bb358e0d0668e839aef35e2c (diff) | |
download | scintilla-mirror-576adef9a5df55d74e2730dc3ffb5db9f0a0a3f2.tar.gz |
Avoid crashing for SCI_MARKERNEXT starting at -1. Bug #3427270.
-rw-r--r-- | src/PerLine.cxx | 2 | ||||
-rw-r--r-- | test/simpleTests.py | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/PerLine.cxx b/src/PerLine.cxx index c31d4ea9b..7e716ccc0 100644 --- a/src/PerLine.cxx +++ b/src/PerLine.cxx @@ -183,6 +183,8 @@ int LineMarkers::MarkValue(int line) { } int LineMarkers::MarkerNext(int lineStart, int mask) const { + if (lineStart < 0) + lineStart = 0; int length = markers.Length(); for (int iLine = lineStart; iLine < length; iLine++) { MarkerHandleSet *onLine = markers[iLine]; diff --git a/test/simpleTests.py b/test/simpleTests.py index 71dab4389..d4163813e 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -684,6 +684,9 @@ class TestMarkers(unittest.TestCase): self.assertEquals(self.ed.MarkerPrevious(1, 2), 0) self.assertEquals(self.ed.MarkerPrevious(2, 2), 2) + def testMarkerNegative(self): + self.assertEquals(self.ed.MarkerNext(-1, 2), -1) + def testLineState(self): self.assertEquals(self.ed.MaxLineState, 0) self.assertEquals(self.ed.GetLineState(0), 0) |