GNOME Bugzilla – Bug 692360
possibly non-threadsafe code in g_content_type_guess()?
Last modified: 2013-01-25 04:53:59 UTC
I don't have any reproducible code but just trying to see any possibilities why happened. it was originally reported at https://bugzilla.redhat.com/show_bug.cgi?id=768580 The backtrace says:
+ Trace 231417
It was segfault there. content_type should be came from g_content_type_guess() in get_content_type() in glocalfileinfo.c. the code in question is this: /* Got an extension match, and no conflicts. This is it. */ if (n_name_mimetypes == 1) { G_UNLOCK (gio_xdgmime); return g_strdup (name_mimetypes[0]); } name_mimetypes might be broken after Mutex is unlocked if another thread enters into it. shouldn't it be: /* Got an extension match, and no conflicts. This is it. */ if (n_name_mimetypes == 1) { gchar *r = g_strdup (name_mimetypes[0]); G_UNLOCK (gio_xdgmime); return r; } or something like that?
You are right. Can you provide a patch ?
Created attachment 234273 [details] [review] gcontenttype: Duplicate the string inside Mutex lock for thread-safety
Review of attachment 234273 [details] [review]: looks good, please commit
The following fix has been pushed: 7261294 gcontenttype: Duplicate the string inside Mutex lock for thread-safety
Created attachment 234365 [details] [review] gcontenttype: Duplicate the string inside Mutex lock for thread-safety