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 104328 - gedit segfault with huge file
gedit segfault with huge file
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.2.x
Other other
: Normal major
: 1.2.2
Assigned To: gtk-bugs
gtk-bugs
Depends on: 68435
Blocks:
 
 
Reported: 2003-01-20 13:58 UTC by bugs
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.1/2.2


Attachments
test file to reproduce the behaviour (bzip2 compressed text) (34.85 KB, application/octet-stream)
2003-01-25 12:52 UTC, Johannes Berg
Details

Description bugs 2003-01-24 15:26:40 UTC
Package: gedit
Severity: normal
Version: 2.0.6
Synopsis: gedit segfault with huge file
Bugzilla-Product: gedit
Bugzilla-Component: general

Description:
Description of Problem:
I was opening a mysql database dump (22mb) in gedit to cut out a few
bits and pieces, and this is what happened (bt in gdb because I didn't
get the gnome-segfault-dialog)

Program received signal SIGSEGV, Segmentation fault.
0x40cca7d2 in pango_get_mirror_char () from /usr/lib/libpango-1.0.so.0
(gdb) bt
  • #0 pango_get_mirror_char
    from /usr/lib/libpango-1.0.so.0
  • #1 pango_log2vis_get_embedding_levels
    from /usr/lib/libpango-1.0.so.0
  • #2 pango_itemize
    from /usr/lib/libpango-1.0.so.0
  • #3 no_shape_filter_func
    from /usr/lib/libpango-1.0.so.0
  • #4 pango_layout_get_cursor_pos
    from /usr/lib/libpango-1.0.so.0
  • #5 pango_layout_get_extents
    from /usr/lib/libpango-1.0.so.0
  • #6 gtk_text_layout_get_line_display
    from /usr/lib/libgtk-x11-2.0.so.0
  • #7 gtk_text_layout_validate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #8 gtk_text_layout_wrap
    from /usr/lib/libgtk-x11-2.0.so.0
  • #9 _gtk_text_btree_is_valid
    from /usr/lib/libgtk-x11-2.0.so.0
  • #10 _gtk_text_btree_is_valid
    from /usr/lib/libgtk-x11-2.0.so.0
  • #11 _gtk_text_btree_is_valid
    from /usr/lib/libgtk-x11-2.0.so.0
  • #12 _gtk_text_btree_is_valid
    from /usr/lib/libgtk-x11-2.0.so.0
  • #13 _gtk_text_btree_validate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #14 gtk_text_layout_validate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #15 gtk_text_view_place_cursor_onscreen
    from /usr/lib/libgtk-x11-2.0.so.0
  • #16 g_timeout_add
    from /usr/lib/libglib-2.0.so.0
  • #17 g_get_current_time
    from /usr/lib/libglib-2.0.so.0
  • #18 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #19 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #20 g_main_context_iteration
    from /usr/lib/libglib-2.0.so.0
  • #21 gtk_main_iteration
    from /usr/lib/libgtk-x11-2.0.so.0
  • #22 gedit_utils_flash
  • #23 gedit_utils_flash_va
  • #24 gedit_file_open_single_uri
  • #25 gedit_file_open_recent
  • #26 gnome_recent_BOOLEAN__STRING
  • #27 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #28 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #29 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #30 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #31 gnome_recent_view_set_model
  • #32 bonobo_socket_add_id
    from /usr/lib/libbonoboui-2.so.0
  • #33 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #34 bonobo_closure_invoke_va_list
    from /usr/lib/libbonobo-2.so.0
  • #35 bonobo_closure_invoke
    from /usr/lib/libbonobo-2.so.0
  • #36 bonobo_socket_add_id
    from /usr/lib/libbonoboui-2.so.0
  • #37 Bonobo_UIComponent_execVerb
    from /usr/lib/libbonobo-2.so.0
  • #38 bonobo_ui_engine_get_ui_container
    from /usr/lib/libbonoboui-2.so.0
  • #39 bonobo_ui_engine_get_ui_container
    from /usr/lib/libbonoboui-2.so.0
  • #40 g_cclosure_marshal_VOID__POINTER
    from /usr/lib/libgobject-2.0.so.0
  • #41 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #42 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #43 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #44 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #45 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #46 bonobo_ui_engine_emit_verb_on_w
    from /usr/lib/libbonoboui-2.so.0
  • #47 bonobo_ui_sync_menu_add_popup
    from /usr/lib/libbonoboui-2.so.0
  • #48 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #49 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #50 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #51 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #52 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #53 gtk_widget_activate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #54 gtk_menu_shell_activate_item
    from /usr/lib/libgtk-x11-2.0.so.0
  • #55 _gtk_menu_shell_activate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #56 gtk_menu_reorder_child
    from /usr/lib/libgtk-x11-2.0.so.0
  • #57 _gtk_marshal_BOOLEAN__BOXED
    from /usr/lib/libgtk-x11-2.0.so.0
  • #58 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #59 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #60 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #61 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #62 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #63 gtk_widget_send_expose
    from /usr/lib/libgtk-x11-2.0.so.0
  • #64 gtk_propagate_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #65 gtk_main_do_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #66 _gdk_events_queue
    from /usr/lib/libgdk-x11-2.0.so.0
  • #67 g_get_current_time
    from /usr/lib/libglib-2.0.so.0
  • #68 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #69 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #70 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #71 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #72 main
  • #73 __libc_start_main
    from /lib/libc.so.6

I can reproduce that using the database dump every time I open it, but I
don't know for sure what is causing it. Probably because the dump is not
UTF-8 but something really strange (users like to enter weird characters
into my database and I forgot to encode the dump properly)

I know this will end up with NEEDINFO, but I don't know what more info
to give, so just tell me :)




------- Bug moved to this database by unknown@bugzilla.gnome.org 2003-01-24 10:26 -------

The original reporter (bugs@johannes.sipsolutions.de) of this bug does not have an account here.
Reassigning to the exporter, unknown@bugzilla.gnome.org.
Reassigning to the default owner of the component, maggi@athena.polito.it.

Comment 1 Paolo Maggi 2003-01-24 18:14:39 UTC
hmmm... it seems a gtk+ bug but I'm not sure.
Please, if you have compiled gtk+ by yourself, try to load the file
using the testtext program you find in the gtk+/tests directory and
lemme know if it works or not.
I don't think the problem is due to the fact the dump is not UTF-8.

Thanks.
Comment 2 Johannes Berg 2003-01-25 09:56:46 UTC
I had not built gtk myself, but here's what I did now:
a) download gtk2 sources
a1) ./configure
a2) cd tests; make testtext # error due to library not built yet

b) link using the .la files present on my system
$ /bin/sh libtool --mode=link gcc  -g -O2 -Wall  -o testtext
prop-editor.o testtext.o /usr/lib/libgdk_pixbuf-2.0.la
/usr/lib/libgdk-x11-2.0.la /usr/lib/libgtk-x11-2.0.la

c) ./testtext

Well, then I loaded the document into testtext and after about 480
lines it complained that it wasn't valid UTF-8, clipped the text there
and showed the top 480 lines of the document, but other than that
nothing happened

PS: Cannot reopen since I'm not the owner/submitter (because I used
bug-buddy, sorry)
Comment 3 Andrew Sobala 2003-01-25 12:21:25 UTC
Looks like a similar trace to bug 86713, but upgraded to the newer
version of gedit :)
Comment 4 Johannes Berg 2003-01-25 12:25:44 UTC
give me a bit, and I'll try to reproduce with a smaller file so you
can try it
Comment 5 Johannes Berg 2003-01-25 12:31:22 UTC
I'm getting the impression that its related to *extremely* long lines
(like 7mb in a line or so)
Comment 6 Johannes Berg 2003-01-25 12:52:14 UTC
attaching the best I can do - few hundred k file with nothing but a's
in it (and a few special symbols).. its my db dump where I replaced
all characters/numbers by a to protect my database and to make it
compressible...
bunzip2 it and load it, segfaults for me right away (gedit cut4.dump)
Comment 7 Johannes Berg 2003-01-25 12:52:59 UTC
Created attachment 13820 [details]
test file to reproduce the behaviour (bzip2 compressed text)
Comment 8 Paolo Maggi 2003-01-27 09:54:11 UTC
I'm quite sure this is a gtk+ or pango bug since I get the same crash
(with the same trace in bluefish).

In the following I will use the file provided by Johannes

Note that I cannot reproduce the crash in testtext since the file
contains non valid utf8 text.
I also noted that if I load the file in gvim, copy it and paste it in
gedit, bluefish and/or test-glimmer-widget  I get a crash (quite
immediately).
I don't get this crash in gtk-demo or testtext, but CPU goes to 100%
for a very long period and you cannot see the reault since every time
you expose the window the CPU restarts to go to 100%.

The traces I get are:

1. Loading the file

======================

  • #0 fribidi_analyse_string
    at fribidi.c line 578
  • #1 pango_log2vis_get_embedding_levels
    at fribidi.c line 1079
  • #2 pango_itemize
  • #3 pango_layout_check_lines
    at pango-layout.c line 2981
  • #4 pango_layout_get_extents_internal
    at pango-layout.c line 1879
  • #5 pango_layout_get_extents
    at pango-layout.c line 2004
  • #6 gtk_text_layout_get_line_display
    at gtktextlayout.c line 1949
  • #7 gtk_text_layout_get_cursor_locations
    at gtktextlayout.c line 2175
  • #8 gtk_text_view_get_virtual_cursor_pos
    at gtktextview.c line 6308
  • #9 gtk_text_view_update_im_spot_location
    at gtktextview.c line 1727
  • #10 gtk_text_view_mark_set_handler
    at gtktextview.c line 6282
  • #11 _gtk_marshal_VOID__BOXED_OBJECT
    at gtkmarshalers.c line 938
  • #12 g_closure_invoke
    at gclosure.c line 437
  • #13 signal_emit_unlocked_R
    at gsignal.c line 2822
  • #14 g_signal_emit_valist
    at gsignal.c line 2554
  • #15 g_signal_emit
    at gsignal.c line 2612
  • #16 gtk_text_buffer_mark_set
    at gtktextbuffer.c line 1663
  • #17 gtk_text_buffer_place_cursor
    at gtktextbuffer.c line 2019
  • #18 gedit_document_goto_line
    at gedit-document.c line 1686
  • #19 gedit_file_open_uri_list
    at gedit-file.c line 803
  • #20 gedit_load_file_list
    at gedit2.c line 165
  • #21 gtk_main
    at gtkmain.c line 1084
  • #22 main
    at gedit2.c line 394
  • #23 __libc_start_main
    from /lib/libc.so.6
  • #0 fribidi_analyse_string
    at fribidi.c line 578
  • #1 pango_log2vis_get_embedding_levels
    at fribidi.c line 1079
  • #2 pango_itemize
  • #3 pango_layout_check_lines
    at pango-layout.c line 2981
  • #4 pango_layout_get_extents_internal
    at pango-layout.c line 1879
  • #5 pango_layout_get_extents
    at pango-layout.c line 2004
  • #6 gtk_text_layout_get_line_display
    at gtktextlayout.c line 1949
  • #7 gtk_text_layout_real_wrap
    at gtktextlayout.c line 937
  • #8 gtk_text_layout_wrap
    at gtktextlayout.c line 554
  • #9 _gtk_text_btree_validate_line
    at gtktextbtree.c line 5190
  • #10 gtk_text_layout_validate_yrange
    at gtktextlayout.c line 853
  • #11 gtk_text_view_validate_onscreen
    at gtktextview.c line 3035
  • #12 gtk_text_view_flush_first_validate
    at gtktextview.c line 3091
  • #13 first_validate_callback
    at gtktextview.c line 3112
  • #14 g_idle_dispatch
    at gmain.c line 3164
  • #15 g_main_dispatch
    at gmain.c line 1653
  • #16 g_main_context_dispatch
    at gmain.c line 2197
  • #17 g_main_context_iterate
    at gmain.c line 2278
  • #18 g_main_loop_run
    at gmain.c line 2498
  • #19 gtk_main
    at gtkmain.c line 1092
  • #20 main
    at gedit2.c line 394
  • #21 __libc_start_main
    from /lib/libc.so.6

======================
Comment 9 Matthias Clasen 2003-01-27 19:58:33 UTC
fribidi_analyse_string tries to alloca a buffer with the length of the
string, which is obviously a bad idea when the length is 609280...
Comment 10 Matthias Clasen 2003-01-27 21:59:31 UTC
Newer versions of fribidi use malloc here, so this bug will go away
when Pango moves to a newer fribidi, see bug 68435
Comment 11 Owen Taylor 2003-05-27 23:25:10 UTC
Decided to just go ahead and fix it in our copy of mini-fribidi,
since it was trivial.

Tue May 27 18:37:44 2003  Owen Taylor  <otaylor@redhat.com>
 
        * pango/mini-fribidi/fribidi.c (fribidi_analyse_string):
        Limit the size of the buffers we alloca(). (#104238)