summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-19 20:12:40 +0100
committerAndras Timar <andras.timar@collabora.com>2018-05-15 10:13:42 +0200
commit8be163e686cf548e5ace5de010487619ccfac1ef (patch)
tree1952fcafe0f28642a70f53f254eee69adfa5fa3e /vcl/unx
parent8e1ad80835ee3365a12346f7be9e7ef8f76ef3d9 (diff)
Resolves: tdf#116951 rhbz#1569331 start is G_MAXINT
and text is nullptr, seeing as an end G_MAXINT translates to str len, assume the same for start Reviewed-on: https://gerrit.libreoffice.org/53376 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 697ebd15d646e41bb69726f7b438ebbfaff141b0) Related: tdf#116951 rhbz#1569331 end should be in terms of unicode chars not bytes Reviewed-on: https://gerrit.libreoffice.org/53175 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit d4a01820ae094ef2d4ec2196334120600b1c9621) Change-Id: I05114019abb6c283586cd5c23ed1d148c9cf71d3 Reviewed-on: https://gerrit.libreoffice.org/53176 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit f7d8a6ffae387a2698b07a8841e09ca3ed0bb000)
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx10
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx10
2 files changed, 16 insertions, 4 deletions
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index ff540dc8fd1d..d57ec7162d69 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -3650,8 +3650,14 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
ExtTextInputAttr sal_attr = ExtTextInputAttr::NONE;
pango_attr_iterator_range (iter, &start, &end);
- if (end == G_MAXINT)
- end = pText ? strlen (pText) : 0;
+ if (start == G_MAXINT || end == G_MAXINT)
+ {
+ auto len = pText ? g_utf8_strlen(pText, -1) : 0;
+ if (end == G_MAXINT)
+ end = len;
+ if (start == G_MAXINT)
+ start = len;
+ }
if (end == start)
continue;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index c8c98f5c5255..40e1d1412d6a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -4006,8 +4006,14 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
ExtTextInputAttr sal_attr = ExtTextInputAttr::NONE;
pango_attr_iterator_range (iter, &start, &end);
- if (end == G_MAXINT)
- end = pText ? strlen (pText) : 0;
+ if (start == G_MAXINT || end == G_MAXINT)
+ {
+ auto len = pText ? g_utf8_strlen(pText, -1) : 0;
+ if (end == G_MAXINT)
+ end = len;
+ if (start == G_MAXINT)
+ start = len;
+ }
if (end == start)
continue;