After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 732737 - Long string values can crash editor
Long string values can crash editor
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-07-04 11:56 UTC by Marek Kašík
Modified: 2018-04-15 00:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Ellipsize string values (906 bytes, patch)
2014-07-04 11:56 UTC, Marek Kašík
none Details | Review
picture of the problem (91.43 KB, image/png)
2014-07-04 17:34 UTC, Allison Karlitskaya (desrt)
  Details

Description Marek Kašík 2014-07-04 11:56:18 UTC
Created attachment 279898 [details] [review]
Ellipsize string values

Keys with long string values can cause problems with allocation of memory for the Gtk.CellRendererText which shows the values in dconf-editor. I've observed a crash caused by this on virtual machines (it is probably related to amount of video memory).
Ellipsizing solves the problem for me.

Attached is a patch which ellipsize the text renderer.

Marek
Comment 1 Allison Karlitskaya (desrt) 2014-07-04 17:29:00 UTC
I put a 50MB string into dconf and this is 100% reproducible.  I don't get an outright crash, though -- rather just an extremely long computation.

This is surely either a gtk or pango bug...

Here's a backtrace from some randomly chosen point:


  • #0 g_unichar_iswide
    at guniprop.c line 482
  • #1 width_iter_next
    at pango-context.c line 871
  • #2 width_iter_init
    at pango-context.c line 884
  • #3 itemize_state_init
    at pango-context.c line 961
  • #4 pango_itemize_with_base_dir
    at pango-context.c line 1586
  • #5 pango_layout_check_lines
    at pango-layout.c line 3998
  • #6 pango_layout_get_extents_internal
    at pango-layout.c line 2587
  • #7 pango_layout_get_extents
    at pango-layout.c line 2782
  • #8 gtk_cell_renderer_text_get_preferred_width
    at gtkcellrenderertext.c line 2156
  • #9 gtk_cell_renderer_get_preferred_width
    at gtkcellrenderer.c line 1476
  • #10 key_value_renderer_real_get_preferred_width
  • #11 gtk_cell_renderer_get_preferred_width
    at gtkcellrenderer.c line 1476
  • #12 gtk_cell_area_request_renderer
    at gtkcellarea.c line 3597
  • #13 compute_size
    at gtkcellareabox.c line 1524
  • #14 gtk_cell_area_box_get_preferred_width
    at gtkcellareabox.c line 1813
  • #15 gtk_tree_view_column_cell_get_size
    at gtktreeviewcolumn.c line 2896
  • #16 validate_row
    at gtktreeview.c line 6176
  • #17 validate_visible_area
    at gtktreeview.c line 6495
  • #18 do_presize_handler
    at gtktreeview.c line 6829
  • #19 presize_handler_callback
    at gtktreeview.c line 6858
  • #20 gtk_widget_on_frame_clock_update
    at gtkwidget.c line 4774
  • #21 _g_closure_invoke_va
    at gclosure.c line 840
  • #22 g_signal_emit_valist
    at gsignal.c line 3238
  • #23 g_signal_emit_by_name
    at gsignal.c line 3426
  • #24 gdk_frame_clock_paint_idle
    at gdkframeclockidle.c line 380
  • #25 gdk_threads_dispatch
    at gdk.c line 804
  • #26 g_timeout_dispatch
    at gmain.c line 4451
  • #27 g_main_dispatch
    at gmain.c line 3066
  • #28 g_main_context_dispatch
    at gmain.c line 3642
  • #29 g_main_context_iterate
    at gmain.c line 3713
  • #30 g_main_context_iteration
    at gmain.c line 3774
  • #31 g_application_run
    at gapplication.c line 1635
  • #32 configuration_editor_main
  • #33 __libc_start_main
    at libc-start.c line 285
  • #34 _start

Comment 2 Allison Karlitskaya (desrt) 2014-07-04 17:31:49 UTC
After a while churning at that, we get this output:

(dconf-editor:15561): Gtk-WARNING **: drawing failure for widget `GtkButton': invalid value (typically too big) for the size of the input (surface, pattern, etc.)

(dconf-editor:15561): Gtk-WARNING **: drawing failure for widget `DConfKeyView': invalid value (typically too big) for the size of the input (surface, pattern, etc.)

(dconf-editor:15561): Gtk-WARNING **: drawing failure for widget `GtkScrolledWindow': invalid value (typically too big) for the size of the input (surface, pattern, etc.)

(dconf-editor:15561): Gtk-WARNING **: drawing failure for widget `GtkVBox': invalid value (typically too big) for the size of the input (surface, pattern, etc.)

(dconf-editor:15561): Gtk-WARNING **: drawing failure for widget `GtkHPaned': invalid value (typically too big) for the size of the input (surface, pattern, etc.)

(dconf-editor:15561): Gtk-WARNING **: drawing failure for widget `GtkBox': invalid value (typically too big) for the size of the input (surface, pattern, etc.)

(dconf-editor:15561): Gtk-WARNING **: drawing failure for widget `GtkApplicationWindow': invalid value (typically too big) for the size of the input (surface, pattern, etc.)


and then the display looks like (attached).
Comment 3 Allison Karlitskaya (desrt) 2014-07-04 17:34:20 UTC
Created attachment 279928 [details]
picture of the problem
Comment 4 Allison Karlitskaya (desrt) 2014-07-04 18:13:00 UTC
Marek: what/how-big was the original string in there?   (to avoid the inevitable arguments about if Gtk should really try to cater to people shoving unreasonable things into labels...)
Comment 5 Marek Kašík 2014-07-07 11:58:23 UTC
(In reply to comment #4)
> Marek: what/how-big was the original string in there?   (to avoid the
> inevitable arguments about if Gtk should really try to cater to people shoving
> unreasonable things into labels...)

Unfortunately, I can not reproduce it right now (I'll try it tomorrow in the office). But I think that the string was about 50000 characters long.
I have to admit that this was on Fedora 20 which doesn't have latest gtk+/pango/cairo.
Comment 6 Marek Kašík 2014-07-10 12:07:10 UTC
It doesn't crash for me with current gtk+ (3.13.3). I've tracked down the commit which change that and it is this one: https://git.gnome.org/browse/gtk+/commit/?id=aa339ee30ca1420217e772ce3a5eedb507bf9d67.
I've tried to place the linear gradients back to the "column-header" and it started to crash again. The error is:

(dconf-editor:14655): Gdk-ERROR **: The program 'dconf-editor' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
  (Details: serial 4041 error_code 11 request_code 130 (MIT-SHM) minor_code 5)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

and backtrace from valgrind is:

==14655== Process terminating with default action of signal 5 (SIGTRAP)
==14655==    at 0x3962A504E9: g_logv (gmessages.c:989)
==14655==    by 0x3962A5063E: g_log (gmessages.c:1025)
==14655==    by 0x56C504E: _gdk_x11_display_error_event (gdkdisplay-x11.c:2557)
==14655==    by 0x56D0219: gdk_x_error (gdkmain-x11.c:303)
==14655==    by 0x39646450BA: _XError (XlibInt.c:1463)
==14655==    by 0x39646420B6: handle_error (xcb_io.c:213)
==14655==    by 0x3964642174: handle_response (xcb_io.c:325)
==14655==    by 0x39646430FF: _XReply (xcb_io.c:627)
==14655==    by 0x396463EA2C: XSync (Sync.c:44)
==14655==    by 0x396463EACA: _XSyncFunction (Synchro.c:35)
==14655==    by 0x3964645A0E: _XPrivSyncFunction (XlibInt.c:251)
==14655==    by 0x3964E08ED2: XShmCreatePixmap (XShm.c:429)
==14655==    by 0x396C6A2F63: _cairo_xlib_shm_surface_create.isra.10 (cairo-xlib-surface-shm.c:842)
==14655==    by 0x396C6A33E6: _cairo_xlib_surface_create_shm (cairo-xlib-surface-shm.c:1155)
==14655==    by 0x396C6A347B: _cairo_xlib_surface_create_similar_shm (cairo-xlib-surface-shm.c:1180)
==14655==    by 0x396C67083C: cairo_surface_create_similar_image (cairo-surface.c:593)
==14655==    by 0x396C670A07: cairo_surface_create_similar (cairo-surface.c:518)
==14655==    by 0x4F85BE7: _gtk_css_image_get_surface (gtkcssimage.c:400)
==14655==    by 0x4F10E2C: _gtk_border_image_render (gtkborderimage.c:258)
==14655==    by 0x518EB39: render_frame_internal (gtkthemingengine.c:1736)
==14655==    by 0x518F0A0: gtk_theming_engine_render_frame (gtkthemingengine.c:1786)
==14655==    by 0x512DFC9: gtk_render_frame (gtkstylecontext.c:4012)
==14655==    by 0x4F26A7B: gtk_button_draw (gtkbutton.c:1857)
==14655==    by 0x5054DA3: _gtk_marshal_BOOLEAN__BOXEDv (gtkmarshalers.c:130)
==14655==    by 0x5204045: gtk_widget_draw_marshallerv (gtkwidget.c:1009)
==14655==    by 0x396361043E: _g_closure_invoke_va (gclosure.c:840)
==14655==    by 0x3963629748: g_signal_emit_valist (gsignal.c:3238)
==14655==    by 0x396362A3AE: g_signal_emit (gsignal.c:3386)
==14655==    by 0x520DF30: _gtk_widget_draw_internal (gtkwidget.c:6441)
==14655==    by 0x520E435: _gtk_widget_draw (gtkwidget.c:6619)
==14655==    by 0x4F7AAEA: gtk_container_propagate_draw (gtkcontainer.c:3528)
==14655==    by 0x51DFA6C: gtk_tree_view_draw (gtktreeview.c:5513)


I guess that if there are no linear-gradients then there is an optimization which allows gtk+ to create such big widget (316115 x 24 in this case).

I'm not sure whether this is solvable since there is not enough memory. This is on a computer with integrated graphic card: Intel Corporation 82Q35 Express Integrated Graphics Controller.
Comment 7 Allison Karlitskaya (desrt) 2014-07-10 13:51:23 UTC
Seems to be two separate issues here: Gtk behaves badly under the new theme with very large widgets, and badly in a different way with hilariously large widgets (even with the old theme).
Comment 8 Matthias Clasen 2018-02-10 05:15:42 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 9 Matthias Clasen 2018-04-15 00:06:57 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new