diff options
author | Andrey Loskutov | 2019-02-03 20:02:01 +0000 |
---|---|---|
committer | Andrey Loskutov | 2019-02-04 11:17:54 +0000 |
commit | 4e982f236b057723c4407d1d433bce7d38b87e28 (patch) | |
tree | c657d1a7a650c8a58037c2fad1875b806c5cc660 | |
parent | 5b28801a587ebcce55a1d43f1dc7d25e233d5d1b (diff) | |
download | eclipse.platform.swt-4e982f236b057723c4407d1d433bce7d38b87e28.tar.gz eclipse.platform.swt-4e982f236b057723c4407d1d433bce7d38b87e28.tar.xz eclipse.platform.swt-4e982f236b057723c4407d1d433bce7d38b87e28.zip |
Bug 48020 - added range checks in StyledTextRenderer.textChanging()
This should hopefully give some hints where the wrong data is coming
from.
Change-Id: I64f2a125738e16d5a952fba1b8f552f3f50b7ce4
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java index 776d6ff069..98c43dbb3f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java @@ -1641,6 +1641,14 @@ void textChanging(TextChangingEvent event) { lineSizes = new LineSizeInfo[lineCount]; reset(0, lineCount); } else { + int startIndex = startLine + replaceLineCount + 1; + int endIndex = startLine + newLineCount + 1; + if(lineCount < startLine) { + SWT.error(SWT.ERROR_INVALID_RANGE, null, "bug 478020: lineCount < startLine: " + lineCount + ":" + startLine); + } + if(lineCount < startIndex) { + SWT.error(SWT.ERROR_INVALID_RANGE, null, "bug 478020: lineCount < startIndex: " + lineCount + ":" + startIndex); + } int delta = newLineCount - replaceLineCount; if (lineCount + delta > lineSizes.length) { LineSizeInfo[] newLineSizes = new LineSizeInfo[lineCount + delta + GROW]; @@ -1654,8 +1662,6 @@ void textChanging(TextChangingEvent event) { lines = newLines; } } - int startIndex = startLine + replaceLineCount + 1; - int endIndex = startLine + newLineCount + 1; System.arraycopy(lineSizes, startIndex, lineSizes, endIndex, lineCount - startIndex); for (int i = startLine; i < endIndex; i++) { lineSizes[i] = null; |