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 565484 - g_content_type_guess passes non-UTF8 text to XDG functions in non-UTF8 locale
g_content_type_guess passes non-UTF8 text to XDG functions in non-UTF8 locale
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.18.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 565982 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-12-23 17:41 UTC by Josselin Mouette
Modified: 2009-01-12 20:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Josselin Mouette 2008-12-23 17:41:41 UTC
Original bug report: http://bugs.debian.org/509582

This bug only occurs in a non-UTF8 locale (e.g. fr_FR@euro), when using local encoding filenames, with or without G_BROKEN_FILENAMES.

To reproduce it:
 mkdir /tmp/toto
 echo text > /tmp/toto/AA1-XxxxxXxxxxxxxé  (the filename must be in iso8859-1 encoding here)
Then try to open this file with the file chooser in gedit.

To be sure to see the bug it is better to set MALLOC_CHECK_=2. In which case, the libc always aborts at xdgmimeglob.c:401 (free(ucs4);).

The reason is that, in this case, g_content_type_guess passes an invalid UTF8 string to xdg_mime_get_mime_types_from_file_name, and the XDG functions all assume their input is valid UTF8.


Full backtrace :
  • #0 raise
    from /lib/libc.so.6
  • #1 abort
    from /lib/libc.so.6
  • #2 malloc_printerr
    from /lib/libc.so.6
  • #3 __gio_xdg_hash_lookup_file_name
    at /build/buildd/glib2.0-2.18.2/gio/xdgmime/xdgmimeglob.c line 401
  • #4 IA__g_content_type_guess
    at /build/buildd/glib2.0-2.18.2/gio/gcontenttype.c line 916
  • #5 get_content_type
    at /build/buildd/glib2.0-2.18.2/gio/glocalfileinfo.c line 1225
  • #6 _g_local_file_info_get
    at /build/buildd/glib2.0-2.18.2/gio/glocalfileinfo.c line 1556
  • #7 g_local_file_query_info
    at /build/buildd/glib2.0-2.18.2/gio/glocalfile.c line 1173
  • #8 _gedit_tab_get_icon
  • #9 ??
  • #10 IA__g_closure_invoke
    at /build/buildd/glib2.0-2.18.2/gobject/gclosure.c line 767
  • #11 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 3244
  • #12 IA__g_signal_emit_valist
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 2977
  • #13 IA__g_signal_emit
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 3034
  • #14 g_object_dispatch_properties_changed
    at /build/buildd/glib2.0-2.18.2/gobject/gobject.c line 766
  • #15 IA__g_object_notify
    at /build/buildd/glib2.0-2.18.2/gobject/gobjectnotifyqueue.c line 125
  • #16 ??
  • #17 IA__g_closure_invoke
    at /build/buildd/glib2.0-2.18.2/gobject/gclosure.c line 767
  • #18 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 3244
  • #19 IA__g_signal_emit_valist
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 2977
  • #20 IA__g_signal_emit
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 3034
  • #21 ??
  • #22 IA__g_closure_invoke
    at /build/buildd/glib2.0-2.18.2/gobject/gclosure.c line 767
  • #23 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 3244
  • #24 IA__g_signal_emit_valist
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 2977
  • #25 IA__g_signal_emit
    at /build/buildd/glib2.0-2.18.2/gobject/gsignal.c line 3034
  • #26 gedit_document_loader_loading
  • #27 ??
  • #28 g_timeout_dispatch
    at /build/buildd/glib2.0-2.18.2/glib/gmain.c line 3589
  • #29 IA__g_main_context_dispatch
    at /build/buildd/glib2.0-2.18.2/glib/gmain.c line 2144
  • #30 g_main_context_iterate
    at /build/buildd/glib2.0-2.18.2/glib/gmain.c line 2778
  • #31 IA__g_main_loop_run
    at /build/buildd/glib2.0-2.18.2/glib/gmain.c line 2986
  • #32 IA__gtk_main
    at /scratch/build-area/gtk+2.0-2.14.4/gtk/gtkmain.c line 1200
  • #33 main

Comment 1 Matthias Clasen 2009-01-03 06:00:40 UTC
*** Bug 565982 has been marked as a duplicate of this bug. ***
Comment 2 Josselin Mouette 2009-01-12 20:25:07 UTC
Apparently fixed in trunk and 2.18.4.

 * xdgmime/xdgmimecache.c:
 * xdgmime/xdgmimeglob.c: Don't assume filenames are UTF-8.