aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-10-19 21:52:08 +1100
committerNeil <nyamatongwe@gmail.com>2015-10-19 21:52:08 +1100
commitef75a00a35ddc6dbd8593f3fb94e8fbe048ff410 (patch)
tree32dab69789f83ab7675f772ebc81d2d0fa29164a
parent0d0f2a1cc688e39fda86273cb32d28053a237137 (diff)
downloadscintilla-mirror-ef75a00a35ddc6dbd8593f3fb94e8fbe048ff410.tar.gz
Bug [#1768]. Report error when negative length passed to SCI_SETSTYLING.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--src/Editor.cxx5
2 files changed, 8 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 87f79f755..35592a94c 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -530,6 +530,10 @@
Optimise marker redrawing by only drawing affected lines when markers shown in the text.
</li>
<li>
+ Report error (SC_STATUS_FAILURE) when negative length passed to SCI_SETSTYLING.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1768/">Bug #1768</a>.
+ </li>
+ <li>
When SC_MARK_UNDERLINE if not assigned to a margin, stop drawing the whole line.
</li>
<li>
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 8a3a367db..6141b0628 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -6267,7 +6267,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_SETSTYLING:
- pdoc->SetStyleFor(static_cast<int>(wParam), static_cast<char>(lParam));
+ if (static_cast<int>(wParam) < 0)
+ errorStatus = SC_STATUS_FAILURE;
+ else
+ pdoc->SetStyleFor(static_cast<int>(wParam), static_cast<char>(lParam));
break;
case SCI_SETSTYLINGEX: // Specify a complete styling buffer