summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-19 20:12:40 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-04-26 16:17:02 +0200
commitf7d8a6ffae387a2698b07a8841e09ca3ed0bb000 (patch)
treee84e298a03b5605fc7c8af3d28f1cbe48e16bc5a /vcl/unx
parent151e7be164774da3251ee06be872cc85a1a9dfb7 (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>
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;