libc6 crash on certain UTF8 encoded filename

Bug #28640 reported by Billy Kwong
108
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
Fix Released
High
Jeff Bailey
langpack-locales (Ubuntu)
Invalid
High
Unassigned

Bug Description

Whenever I browse in any GTK2 apps to a directory with UTF8 filenames, the app would segfault. (So far, beep-media-player and nautilus does this)

I have provided a backtrace from beep-media-player for your reference. Beep crashed when I was in the GTK2 file dialog into said directory.

(gdb) bt
#0 0xb769ed9c in wcsxfrm_l () from /lib/tls/i686/cmov/libc.so.6
#1 0xb769dda8 in wcsxfrm () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7799551 in g_utf8_collate_key () from /usr/lib/libglib-2.0.so.0
#3 0xb7799909 in g_utf8_collate_key_for_filename ()
   from /usr/lib/libglib-2.0.so.0
#4 0xb7c6d024 in gtk_file_info_get_display_key ()
   from /usr/lib/libgtk-x11-2.0.so.0
#5 0xb7c5f058 in _gtk_file_chooser_default_get_type ()
   from /usr/lib/libgtk-x11-2.0.so.0
#6 0xb7d65a8c in gtk_tree_model_sort_get_model ()
   from /usr/lib/libgtk-x11-2.0.so.0
#7 0xb77849f7 in g_qsort_with_data () from /usr/lib/libglib-2.0.so.0
#8 0xb775f945 in g_array_sort_with_data () from /usr/lib/libglib-2.0.so.0
#9 0xb7d66ba0 in gtk_tree_model_sort_clear_cache ()
   from /usr/lib/libgtk-x11-2.0.so.0
#10 0xb7d673d8 in gtk_tree_model_sort_clear_cache ()
   from /usr/lib/libgtk-x11-2.0.so.0
#11 0xb7d67fdd in gtk_tree_model_sort_convert_child_iter_to_iter ()
   from /usr/lib/libgtk-x11-2.0.so.0
#12 0xb7d5f362 in gtk_tree_model_get_iter () from /usr/lib/libgtk-x11-2.0.so.0
#13 0xb7d8384e in gtk_tree_view_set_model () from /usr/lib/libgtk-x11-2.0.so.0
#14 0xb7c5f4b0 in _gtk_file_chooser_default_get_type ()
   from /usr/lib/libgtk-x11-2.0.so.0
#15 0xb7c60272 in _gtk_file_chooser_default_get_type ()
   from /usr/lib/libgtk-x11-2.0.so.0
#16 0xb77f3639 in g_cclosure_marshal_VOID__VOID ()
   from /usr/lib/libgobject-2.0.so.0
#17 0xb77e6798 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#18 0xb77f6689 in g_signal_stop_emission () from /usr/lib/libgobject-2.0.so.0
#19 0xb77f8180 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#20 0xb77f84cf in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#21 0xb7c6f5c5 in _gtk_file_system_model_get_path ()
   from /usr/lib/libgtk-x11-2.0.so.0
#22 0xb77f3639 in g_cclosure_marshal_VOID__VOID ()
   from /usr/lib/libgobject-2.0.so.0
#23 0xb77e6798 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#24 0xb77f6689 in g_signal_stop_emission () from /usr/lib/libgobject-2.0.so.0
#25 0xb77f8180 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#26 0xb77fb64c in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
#27 0xb5aebc1a in gtk_file_system_gnome_vfs_new ()
   from /usr/lib/gtk-2.0/2.4.0/filesystems/libgnome-vfs.so
#28 0xb5a7f9ad in gnome_vfs_job_get_count () from /usr/lib/libgnomevfs-2.so.0
#29 0xb7778830 in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
#30 0xb777651e in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#31 0xb77795d4 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#32 0xb77798f8 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#33 0xb7cb22c5 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#34 0x080795ee in main ()

Revision history for this message
Billy Kwong (tuppa) wrote :

Versions of glib and libc:

tuppa@archammer:~$ dpkg -l libglib2.0-0 libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii libc6 2.3.6-0ubuntu4 GNU C Library: Shared libraries and Timezone
ii libglib2.0-0 2.9.2-0ubuntu1 The GLib library of C routines

Revision history for this message
atie (atie-at-matrix) wrote :

I don't have this problem with a directory and a file named in Korean, tested both bmp and nautilus.

beep-media-pla 0.9.7.1+cvs20050803-1ubuntu2
nautilus 2.13.3-0ubuntu5
libgtk2.0-0 2.8.10-1ubuntu1
libgnomeui-0 2.13.0-0ubuntu1
libgnomevfs2-0 2.13.3cvs20060111-0ubuntu1

What is your locale?

Revision history for this message
Billy Kwong (tuppa) wrote :

Traditional Chinese (UTF8) (set in gdm)

BTW, easytag has a similar bug as well. I've pasted a backtrace from gdb.

I've also done a regen of locales, but still no joy.

Program received signal SIGSEGV, Segmentation fault.
0xb76157df in wcscoll_l () from /lib/tls/i686/cmov/libc.so.6
(gdb) bt
#0 0xb76157df in wcscoll_l () from /lib/tls/i686/cmov/libc.so.6
#1 0xb7614d61 in wcscoll () from /lib/tls/i686/cmov/libc.so.6
#2 0xb78d3496 in g_utf8_collate () from /usr/lib/libglib-2.0.so.0
#3 0x0807befb in ?? ()
#4 0x0843ac48 in ?? ()
#5 0x0819a868 in ?? ()
#6 0xbff86308 in ?? ()
#7 0xb78b70e4 in g_free () from /usr/lib/libglib-2.0.so.0
#8 0x0807c8ac in ?? ()
#9 0x0843ce70 in ?? ()
#10 0x0843a928 in ?? ()
#11 0xbff86338 in ?? ()
#12 0x0843a928 in ?? ()
#13 0x08444ee0 in ?? ()
#14 0x0843dd78 in ?? ()
#15 0xbff86378 in ?? ()
#16 0x0807f9c1 in ?? ()
#17 0x08444ee0 in ?? ()
#18 0x0843dd78 in ?? ()
#19 0x0843a928 in ?? ()
#20 0xbff86368 in ?? ()
#21 0x080bcea0 in _IO_stdin_used ()
#22 0x0843cdd0 in ?? ()
#23 0x0843ce70 in ?? ()
#24 0x08435578 in ?? ()
#25 0x00000001 in ?? ()
#26 0x00000003 in ?? ()
#27 0x08435050 in ?? ()
#28 0x0843dd60 in ?? ()
#29 0x08435050 in ?? ()
#30 0x08435210 in ?? ()
#31 0xbff863e8 in ?? ()
#32 0x08071958 in ?? ()
#33 0x08435210 in ?? ()
#34 0x00000000 in ?? ()

Revision history for this message
Billy Kwong (tuppa) wrote :

Oops, I lied.

tuppa@archammer:~$ export|grep -i utf
declare -x GDM_LANG="en_AU.UTF-8"
declare -x LANG="en_AU.UTF-8"
declare -x LANGUAGE="en_AU.UTF-8"

Revision history for this message
Billy Kwong (tuppa) wrote : libc6 crash on certain UTF8 encoded filename (Re: GTK2 apps crash when browsing a directory with UTF8 filenames)

Ok, did more poking around, it seems that the problem is not in glib, but in libc6.

As I went into the directory in question in bash, ls did not seem to have the problem. But once I attempt to use command line completion on one particular directory with an UTF8 encoded name, blammo.

The following is a backtrace from bash (using libc6-dbg):

Program received signal SIGSEGV, Segmentation fault.
0xb7e0383f in *__GI___strcoll_l (s1=0x1 <Address 0x1 out of bounds>,
    s2=0x81b7d68 "LOVE 05 \uffff\203\205\uffff\uffff\214\uffff\233\206", l=0x2e35cc)
    at strcoll_l.c:412
412 strcoll_l.c: No such file or directory.
        in strcoll_l.c
(gdb) bt
#0 0xb7e0383f in *__GI___strcoll_l (s1=0x1 <Address 0x1 out of bounds>,
    s2=0x81b7d68 "LOVE 05 \uffff\203\205\uffff\uffff\214\uffff\233\206", l=0x2e35cc)
    at strcoll_l.c:412
#1 0xb7dffeb6 in *__GI_strcoll (s1=0x2e35cc <Address 0x2e35cc out of bounds>,
    s2=0x2e35cc <Address 0x2e35cc out of bounds>) at strcoll.c:37
#2 0xb7dc3ab3 in msort_with_tmp (b=0x819e3cc, n=2, s=4,
    cmp=0x80c10f1 <_rl_qsort_string_compare>, t=0xbfe241b0 "4") at msort.c:56
#3 0xb7dc3c4c in *__GI_qsort (b=0x819e3cc, n=2, s=4,
    cmp=0x80c10f1 <_rl_qsort_string_compare>) at msort.c:102
#4 0x080b8ca0 in rl_filename_completion_function ()
#5 0x080b91ec in rl_complete_internal ()
#6 0x080b2fe2 in _rl_dispatch_subseq ()
#7 0x080b332e in _rl_dispatch ()
#8 0x080b33c6 in readline_internal_char ()
#9 0x080b350a in readline ()
#10 0x0805eae4 in yy_input_name ()
#11 0x08060cc1 in execute_prompt_command ()
#12 0x08061e01 in execute_prompt_command ()
#13 0x08064c92 in yyparse ()
#14 0x0805e564 in parse_command ()
#15 0x0805e602 in read_command ()
#16 0x0805e77f in reader_loop ()
#17 0x0805e314 in main ()

More of an administrative question, how do I reassign the source package of an existing bug?

Revision history for this message
Sebastien Bacher (seb128) wrote : Re: GTK2 apps crash when browsing a directory with UTF8 filenames

Thanks for tracking that. We have some crashes with a such backtrace and I was suspecting glib or the libc. Could you provide an example to get that crash? Maybe a tar of a the directory with the issue or just the specific filename doing that? To reassign a package click on the line about the bug in the table of the top of the page, you get the settings page where you can change the source package

Revision history for this message
Billy Kwong (tuppa) wrote :

The filename in question is "LOVE 05 \uffff\203\205\uffff\uffff\214\uffff\233\206", as shown in the backtrace of bash.

I was able to reproduce the bug in beep-media-player by entering the directory with that filename inside the directory inside a GTK2 file dialog box. In the case of nautilus, simply entering that directory with the filename in question inside would be sufficient to crash nautilus.

With bash, if I attempt to do a command line completion on the filename e.g. typing "LOVE<tab>" would crash bash. Interesting thing is that ls is able to list the contents of the directory fine.

Revision history for this message
Billy Kwong (tuppa) wrote :

An ls of the directory in question:

tuppa@archammer:/opt/mp3/cantonese$ ls
LOVE 05 情歌集

Revision history for this message
atie (atie-at-matrix) wrote : keep crashing since second time

Tested with the directory name, yes both bmp and nautilus crashed from second execution of them. (copied & pasted the name above)

One strange thing is that just after creation of the directory name both program were OK so took a screenshot as attached.

atie@matrix:~$ export|grep -i utf
declare -x LANG="en_US.UTF-8"

Revision history for this message
Sebastien Bacher (seb128) wrote :

Crash easy to reproduce with that folder name, thank you

Changed in glibc:
assignee: nobody → jbailey
Revision history for this message
catinsnow (catinsnow) wrote :
Revision history for this message
atie (atie-at-matrix) wrote :

For the Chinese nick issue on https://launchpad.net/distros/ubuntu/+source/gaim/+bug/28734, workaround was LC_COLLATE="ko_KR.UTF-8" under en_US.UTF-8 locale.

Revision history for this message
Ross Burton (ross) wrote :

I'm seeing this in Evolution when it starts in my Spam folder, export LC_COLLATE=C fixed it.

Revision history for this message
Jeff Bailey (jbailey) wrote :

Bug in libc6, fixed upstream.

Changed in langpack-locales:
status: Unconfirmed → Rejected
Revision history for this message
Jeff Bailey (jbailey) wrote :

2.3.6-0ubuntu5

Changed in glibc:
status: Unconfirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.