[geany/geany] 6cff31: Import fix from upstream Scintilla to fix crash on drag and drop

Colomban Wendling git-noreply at xxxxx
Sat May 25 15:45:07 UTC 2013


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 25 May 2013 15:45:07 UTC
Commit:      6cff31488e2376e34d77c2fe5b2bc8875cab9096
             https://github.com/geany/geany/commit/6cff31488e2376e34d77c2fe5b2bc8875cab9096

Log Message:
-----------
Import fix from upstream Scintilla to fix crash on drag and drop

This imports Scintilla commit 06f36a3217229ec2c2a360e370ae1b07597ce7b6
from HG, "Fix crashes with SelectionText instances that did not have \0
terminators."


Modified Paths:
--------------
    scintilla/gtk/ScintillaGTK.cxx

Modified: scintilla/gtk/ScintillaGTK.cxx
14 files changed, 7 insertions(+), 7 deletions(-)
===================================================================
@@ -1492,15 +1492,15 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio
 	if (selectionTypeData == GDK_TARGET_STRING) {
 		if (IsUnicodeMode()) {
 			// Unknown encoding so assume in Latin1
-			dest = UTF8FromLatin1(dest.c_str(), len);
-			selText.Copy(dest.c_str(), dest.length(), SC_CP_UTF8, 0, selText.rectangular, false);
+			dest = UTF8FromLatin1(dest.c_str(), dest.length());
+			selText.Copy(dest.c_str(), dest.length()+1, SC_CP_UTF8, 0, selText.rectangular, false);
 		} else {
 			// Assume buffer is in same encoding as selection
-			selText.Copy(dest.c_str(), dest.length(), pdoc->dbcsCodePage,
+			selText.Copy(dest.c_str(), dest.length()+1, pdoc->dbcsCodePage,
 				vs.styles[STYLE_DEFAULT].characterSet, isRectangular, false);
 		}
 	} else {	// UTF-8
-		selText.Copy(dest.c_str(), dest.length(), SC_CP_UTF8, 0, isRectangular, false);
+		selText.Copy(dest.c_str(), dest.length()+1, SC_CP_UTF8, 0, isRectangular, false);
 		const char *charSetBuffer = CharacterSetID();
 		if (!IsUnicodeMode() && *charSetBuffer) {
 			// Convert to locale
@@ -1533,9 +1533,9 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) {
 					sel.Range(sel.Main()).Start();
 
 				if (selText.rectangular) {
-					PasteRectangular(selStart, selText.s, selText.len);
+					PasteRectangular(selStart, selText.s, selText.len-1);
 				} else {
-					InsertPaste(selStart, selText.s, selText.len);
+					InsertPaste(selStart, selText.s, selText.len-1);
 				}
 				EnsureCaretVisible();
 			}
@@ -1578,7 +1578,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
 	{
 		std::string tmpstr = Document::TransformLineEnds(text->s, text->len, SC_EOL_LF);
 		newline_normalized = new SelectionText();
-		newline_normalized->Copy(tmpstr.c_str(), tmpstr.length(), SC_CP_UTF8, 0, text->rectangular, false);
+		newline_normalized->Copy(tmpstr.c_str(), tmpstr.length()+1, SC_CP_UTF8, 0, text->rectangular, false);
 		text = newline_normalized;
 	}
 #endif



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list