[geany/geany] 745d15: GTK: Fix off-by-one error in accessible attribute runs

Colomban Wendling git-noreply at xxxxx
Tue Dec 20 20:45:29 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Tue, 20 Dec 2016 20:45:29 UTC
Commit:      745d15de2e82a636985c32d5ac149416783ef5a6
             https://github.com/geany/geany/commit/745d15de2e82a636985c32d5ac149416783ef5a6

Log Message:
-----------
GTK: Fix off-by-one error in accessible attribute runs


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

Modified: scintilla/gtk/ScintillaGTKAccessible.cxx
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -553,15 +553,15 @@ AtkAttributeSet *ScintillaGTKAccessible::GetRunAttributes(int charOffset, int *s
 	}
 	int length = sci->pdoc->Length();
 
-	g_return_val_if_fail(byteOffset < length, NULL);
+	g_return_val_if_fail(byteOffset <= length, NULL);
 
 	const char style = sci->pdoc->StyleAt(byteOffset);
 	// compute the range for this style
 	Position startByte = byteOffset;
 	while (startByte > 0 && sci->pdoc->StyleAt((startByte) - 1) == style)
 		(startByte)--;
-	Position endByte = byteOffset;
-	while ((endByte) + 1 < length && sci->pdoc->StyleAt((endByte) + 1) == style)
+	Position endByte = byteOffset + 1;
+	while (endByte < length && sci->pdoc->StyleAt(endByte) == style)
 		(endByte)++;
 
 	CharacterRangeFromByteRange(startByte, endByte, startChar, endChar);



--------------
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