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 619736 - crash on 0-byte file in log search
crash on 0-byte file in log search
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Chat
2.31.x
Other Linux
: Normal critical
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2010-05-26 16:10 UTC by robert
Modified: 2010-05-27 08:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to fix 0-byte logfile crash (544 bytes, patch)
2010-05-26 16:10 UTC, robert
none Details | Review
updated patch to fix leaks (1.26 KB, patch)
2010-05-26 16:15 UTC, robert
none Details | Review

Description robert 2010-05-26 16:10:09 UTC
Created attachment 162031 [details] [review]
patch to fix 0-byte logfile crash

(empathy:29893): GLib-CRITICAL **: g_utf8_casefold: assertion `str != NULL' failed

Program received signal SIGSEGV, Segmentation fault.
*__GI_strstr (haystack_start=0x0, needle_start=0x159b730 "live.gnome.org")
    at strstr.c:58
58	strstr.c: No such file or directory.
	in strstr.c
(gdb) bt
  • #0 *__GI_strstr
    at strstr.c line 58
  • #1 log_store_empathy_search_new
    at empathy-log-store-empathy.c line 638
  • #2 empathy_log_store_search_new
    at empathy-log-store.c line 142
  • #3 empathy_log_manager_search_new
    at empathy-log-manager.c line 358
  • #4 log_window_find_populate
    at empathy-log-window.c line 609
  • #5 log_window_button_find_clicked_cb
    at empathy-log-window.c line 756
  • #6 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #7 ??
    from /usr/lib/libgobject-2.0.so.0
  • #8 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #9 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #10 ??
    from /usr/lib/libgtk-x11-2.0.so.0
  • #11 ??
    from /usr/lib/libgtk-x11-2.0.so.0
  • #12 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #13 ??
    from /usr/lib/libgobject-2.0.so.0
  • #14 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #16 ??
    from /usr/lib/libgtk-x11-2.0.so.0
  • #17 gtk_propagate_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #18 gtk_main_do_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #19 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #20 g_main_context_dispatch
    from /lib/libglib-2.0.so.0
  • #21 ??
    from /lib/libglib-2.0.so.0
  • #22 g_main_loop_run
    from /lib/libglib-2.0.so.0
  • #23 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #24 main
    at empathy.c line 738
  • #1 log_store_empathy_search_new
    at empathy-log-store-empathy.c line 638
633	      contents = g_mapped_file_get_contents (file);
634	      contents_casefold = g_utf8_casefold (contents, length);
635	
636	      g_mapped_file_unref (file);
637	
638	      if (strstr (contents_casefold, text_casefold))
639	        {
640	          EmpathyLogSearchHit *hit;
641	
642	          hit = log_store_empathy_search_hit_new (self, filename);
(gdb) p filename
$1 = (gchar *) 0x160f9b0 "/home/robot101/.local/share/Empathy/logs/gabble_jabber_bzubhipheron_40gmail_2ecom0/epmfairweather@gmail.com/20090216.log"
(gdb) p file
$2 = (GMappedFile *) 0x1728a20
(gdb) p length
$4 = 0
(gdb) p contents
$3 = (gchar *) 0x0

File is zero-byte - don't know how/why:
-rw------- 1 robot101 robot101 0 Feb 16  2009 /home/robot101/.local/share/Empathy/logs/gabble_jabber_bzubhipheron_40gmail_2ecom0/epmfairweather@gmail.com/20090216.log

Attached patch makes it robust against this. But the UI still blocks while searching, and I have a lot of logs. :'(
Comment 1 robert 2010-05-26 16:15:40 UTC
Created attachment 162033 [details] [review]
updated patch to fix leaks
Comment 2 robert 2010-05-26 16:16:51 UTC
My patch introduced a leak of the GMappedFile, but also the original code leaked the filename if the GMappedFile creation failed.
Comment 3 Guillaume Desmottes 2010-05-27 08:24:24 UTC
Thanks, I merged your patch to 2.30 and master.
I just did some comestic changes to fit with our coding style: we use if (ptr != NULL) and if (value != 0) rather than if (ptr) and if (value).  if (badger) is only used for booleans.

Next time you can use git format-patch for extra git synergy :)

This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.
Comment 4 Guillaume Desmottes 2010-05-27 08:35:54 UTC
FYI I backported your fix to the logger: https://bugs.freedesktop.org/show_bug.cgi?id=28275