From a19969b8cc1d1de3d8119e831a8e017dd256361e Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 18 Dec 2016 16:35:06 +0100 Subject: GTK: Fix off-by-one error in accessible attribute runs --- gtk/ScintillaGTKAccessible.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gtk/ScintillaGTKAccessible.cxx') diff --git a/gtk/ScintillaGTKAccessible.cxx b/gtk/ScintillaGTKAccessible.cxx index 8b68961fa..137b1cd82 100644 --- a/gtk/ScintillaGTKAccessible.cxx +++ b/gtk/ScintillaGTKAccessible.cxx @@ -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); -- cgit v1.2.3