Blame 0001-Resolves-tdf-116951-rhbz-1569331-start-is-G_MAXINT.patch

1e45051
From a1e24ab0a98ea6155c581907aca42532311218df Mon Sep 17 00:00:00 2001
1e45051
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
1e45051
Date: Tue, 24 Apr 2018 11:39:20 +0100
1e45051
Subject: [PATCH] Resolves: tdf#116951 rhbz#1569331 start is G_MAXINT
1e45051
1e45051
and text is nullptr, seeing as an end G_MAXINT translates to str len,
1e45051
assume the same for start
1e45051
1e45051
Change-Id: I76b8bb0e66694129d36bbe08a6d55fc434f3434f
1e45051
---
1e45051
 vcl/unx/gtk3/gtk3gtkframe.cxx | 10 ++++++++--
1e45051
 1 file changed, 8 insertions(+), 2 deletions(-)
1e45051
1e45051
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
1e45051
index 113fcb425963..8a18974d2635 100644
1e45051
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
1e45051
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
1e45051
@@ -3977,8 +3977,14 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
1e45051
         ExtTextInputAttr sal_attr = ExtTextInputAttr::NONE;
1e45051
 
1e45051
         pango_attr_iterator_range (iter, &start, &end;;
1e45051
-        if (end == G_MAXINT)
1e45051
-            end = pText ? g_utf8_strlen(pText, -1) : 0;
1e45051
+        if (start == G_MAXINT || end == G_MAXINT)
1e45051
+        {
1e45051
+            auto len = pText ? g_utf8_strlen(pText, -1) : 0;
1e45051
+            if (end == G_MAXINT)
1e45051
+                end = len;
1e45051
+            if (start == G_MAXINT)
1e45051
+                start = len;
1e45051
+        }
1e45051
         if (end == start)
1e45051
             continue;
1e45051
 
1e45051
-- 
1e45051
2.14.3
1e45051