Crash in notify_surrounding_text()
Steps to reproduce
Occasionally happens when focussing Firefox (Wayland backend)
Version information
Mutter / Shell / GTK3 master from today
Backtrace
#2 0x00007f078cfe58c5 in g_malloc (n_bytes=n_bytes@entry=18446744073709543583) at ../glib/gmem.c:107
#3 0x00007f078cfffb6e in g_strndup
(str=str@entry=0x7f06daefbf01 "eind, das Virus: \"Wir sind im Krieg\"Martin Stransky's BlogOpen \"Martin Stransky's Blog\"✓ Wayland/X11: How to run Firefox in mixed environment✓ WebGL and fgx acceleration on WaylandFedora Firefox t"..., n=18446744073709543582) at ../glib/gstrfuncs.c:425
#4 0x00007f076c804c3d in notify_surrounding_text (context=0x7f0765cdb230 [GtkIMContextWayland]) at ../modules/input/imwayland.c:339
#5 gtk_im_context_wayland_set_surrounding (context=<optimized out>, text=<optimized out>, len=<optimized out>, cursor_index=<optimized out>)
at ../modules/input/imwayland.c:836
#6 0x00007f078760eae3 in mozilla::widget::IMContextWrapper::OnRetrieveSurroundingNative(_GtkIMContext*) (this=0x7f0775541200, aContext=<optimized out>)
at /usr/src/debug/firefox-74.0-5.fc32.x86_64/objdir/dist/include/nsTString.h:161
Apparently, in some cases start
is bigger than end
in https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/modules/input/imwayland.c#L339
cc: @carlosg