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 159373 - gtk+ crashes when pasting illegal utf-8 into entry widget
gtk+ crashes when pasting illegal utf-8 into entry widget
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.4.x
Other Linux
: High critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-11-24 21:23 UTC by Kristian Høgsberg
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Non utf-8 to use for reproducing bug (620 bytes, text/plain)
2004-11-24 21:24 UTC, Kristian Høgsberg
Details

Description Kristian Høgsberg 2004-11-24 21:23:12 UTC
Cat a iso-8859-1 file in a utf-8 gnome-terminal, the non-ascii chars shows up as
squares or blanks depending on the font.  Select some of the text including
non-ascii chars and paste into an entry widget.  This will give the following
warnings:

(gtk-demo:10623): Gdk-WARNING **: Error converting selection from UTF8_STRING

** (gtk-demo:10623): WARNING **: Invalid UTF8 string passed to
pango_layout_set_text()

** (gtk-demo:10623): CRITICAL **: file pango-layout.c: line 1771
(pango_layout_get_cursor_pos): assertion `index >= 0 && index <= layout->length'
failed

** (gtk-demo:10623): CRITICAL **: file pango-layout.c: line 1771
(pango_layout_get_cursor_pos): assertion `index >= 0 && index <= layout->length'
failed

the last warning is repeated everytime the cursor flashes.  Pressing the left or
right arrow keys at this point will crash the application (Segmentation fault).

Stack trace:

(gdb) bt
  • #0 gtk_entry_set_visibility
    from /usr/lib/libgtk-x11-2.0.so.0
  • #1 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #2 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #3 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #4 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #5 g_signal_emitv
    from /usr/lib/libgobject-2.0.so.0
  • #6 gtk_bin_get_child
    from /usr/lib/libgtk-x11-2.0.so.0
  • #7 gtk_binding_set_by_class
    from /usr/lib/libgtk-x11-2.0.so.0
  • #8 gtk_binding_set_by_class
    from /usr/lib/libgtk-x11-2.0.so.0
  • #9 gtk_bindings_activate_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #10 gtk_widget_activate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #11 gtk_entry_set_visibility
    from /usr/lib/libgtk-x11-2.0.so.0
  • #12 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #13 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #14 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #16 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #17 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #18 gtk_widget_activate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #19 gtk_window_propagate_key_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #20 gtk_window_activate_key
    from /usr/lib/libgtk-x11-2.0.so.0
  • #21 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #22 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #23 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #24 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #25 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #26 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #27 gtk_widget_activate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #28 gtk_propagate_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #29 gtk_main_do_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #30 gdk_event_get_graphics_expose
    from /usr/lib/libgdk-x11-2.0.so.0
  • #31 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #32 g_main_context_acquire
    from /usr/lib/libglib-2.0.so.0
  • #33 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #34 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #35 ??
  • #36 _IO_stdin_used
  • #37 ??
  • #38 ??
  • #39 ??
  • #40 _IO_stdin_used
  • #41 _IO_stdin_used
  • #42 ??

Comment 1 Kristian Høgsberg 2004-11-24 21:24:07 UTC
Created attachment 34109 [details]
Non utf-8 to use for reproducing bug
Comment 2 Matthias Clasen 2004-11-26 05:45:49 UTC
2004-11-26  Matthias Clasen  <mclasen@redhat.com>

	* gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list_for_display): 
	Don't crash if Xlib fails to return UTF-8. (#159373, Kristian Høgsberg)