! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Segfault in xfce4-appfinder 4.13.1
Status:
RESOLVED: FIXED
Product:
Xfce4-appfinder
Component:
General

Comments

Description Vitaly Lipatov 2018-09-02 21:51:55 CEST
Program received signal SIGSEGV, Segmentation fault.
0x0000003da1680c03 in _g_utf8_normalize_wc (str=0x0, max_len=max_len@entry=-1, mode=mode@entry=G_NORMALIZE_ALL) at gunidecomp.c:372
372	  while ((max_len < 0 || p < str + max_len) && *p)
(gdb) bt
#0  0x0000003da1680c03 in _g_utf8_normalize_wc (str=0x0, max_len=max_len@entry=-1, mode=mode@entry=G_NORMALIZE_ALL) at gunidecomp.c:372
#1  0x0000003da168113b in g_utf8_normalize (str=<optimized out>, len=len@entry=-1, mode=mode@entry=G_NORMALIZE_ALL) at gunidecomp.c:533
#2  0x0000000000412065 in xfce_appfinder_window_sort_items (model=0x865f70, a=0x7fffffffd3b0, b=0x7fffffffd3d0, data=<optimized out>) at appfinder-window.c:1954
#3  0x00007ffff77be76e in gtk_tree_model_sort_compare_func (a=<optimized out>, b=<optimized out>, user_data=0x7fffffffd510) at gtktreemodelsort.c:1842
#4  0x0000003da1667c6d in node_find_closest (haystack=0xa088a0, needle=needle@entry=0xa23c00, end=0x7fffd0003270, iter_cmp=iter_cmp@entry=0x3da16678f0 <iter_compare>, cmp_data=cmp_data@entry=0x7fffffffd4b0)
    at gsequence.c:1799
#5  0x0000003da16680fe in node_insert_sorted (node=<optimized out>, new=new@entry=0xa23c00, end=<optimized out>, iter_cmp=iter_cmp@entry=0x3da16678f0 <iter_compare>, cmp_data=cmp_data@entry=0x7fffffffd4b0)
    at gsequence.c:2037
#6  0x0000003da1669004 in g_sequence_insert_sorted_iter (seq=0x6637d0, data=<optimized out>, iter_cmp=iter_cmp@entry=0x3da16678f0 <iter_compare>, cmp_data=cmp_data@entry=0x7fffffffd4b0) at gsequence.c:1050
#7  0x0000003da16690c8 in g_sequence_insert_sorted (seq=<optimized out>, data=data@entry=0xa26440, cmp_func=cmp_func@entry=0x7ffff77be710 <gtk_tree_model_sort_compare_func>, cmp_data=<optimized out>)
    at gsequence.c:740
#8  0x00007ffff77c17a9 in gtk_tree_model_sort_insert_value (s_iter=0x7fffffffd4f0, s_path=0x765540, level=0x94d860, tree_model_sort=0x87a280) at gtktreemodelsort.c:2074
#9  gtk_tree_model_sort_row_inserted (s_model=<optimized out>, s_path=0x765540, s_iter=<optimized out>, data=0x87a280) at gtktreemodelsort.c:971
#10 0x0000003da1a109ed in g_closure_invoke (closure=0x867790, return_value=0x0, n_param_values=3, param_values=0x7fffffffd740, invocation_hint=0x7fffffffd6e0) at gclosure.c:804
#11 0x0000003da1a231ce in signal_emit_unlocked_R (node=node@entry=0x7fffe800d9b0, detail=detail@entry=0, instance=instance@entry=0x865f70, emission_return=emission_return@entry=0x0, 
    instance_and_params=instance_and_params@entry=0x7fffffffd740) at gsignal.c:3635
#12 0x0000003da1a2b7b5 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffd918) at gsignal.c:3391
#13 0x0000003da1a2c182 in g_signal_emit (instance=instance@entry=0x865f70, signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3447
#14 0x00007ffff77b7e70 in gtk_tree_model_row_inserted (tree_model=tree_model@entry=0x865f70, path=path@entry=0x765540, iter=iter@entry=0x7fffffffda00) at gtktreemodel.c:1855
#15 0x00007ffff77bd241 in gtk_tree_model_filter_emit_row_inserted_for_path (filter=filter@entry=0x865f70, c_model=c_model@entry=0x6dd9a0, c_path=c_path@entry=0x75acc0, c_iter=c_iter@entry=0x78b9a0)
    at gtktreemodelfilter.c:1954
#16 0x00007ffff77bd933 in gtk_tree_model_filter_row_inserted (c_model=0x6dd9a0, c_path=0x75acc0, c_iter=0x78b9a0, data=0x865f70) at gtktreemodelfilter.c:2283
#17 0x0000003da1a109ed in g_closure_invoke (closure=0x89ac30, return_value=0x0, n_param_values=3, param_values=0x7fffffffdd20, invocation_hint=0x7fffffffdcc0) at gclosure.c:804
#18 0x0000003da1a231ce in signal_emit_unlocked_R (node=node@entry=0x7fffe800d9b0, detail=detail@entry=0, instance=instance@entry=0x6dd9a0, emission_return=emission_return@entry=0x0, 
    instance_and_params=instance_and_params@entry=0x7fffffffdd20) at gsignal.c:3635
#19 0x0000003da1a2b7b5 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffdef8) at gsignal.c:3391
#20 0x0000003da1a2c182 in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3447
#21 0x00007ffff77b7e70 in gtk_tree_model_row_inserted (tree_model=<optimized out>, path=path@entry=0x75acc0, iter=iter@entry=0x7fffffffdfd0) at gtktreemodel.c:1855
#22 0x000000000040df18 in xfce_appfinder_model_collect_idle (user_data=<optimized out>) at appfinder-model.c:757
#23 0x00007ffff71c6700 in gdk_threads_dispatch (data=0x796040) at gdk.c:743
#24 0x0000003da164ee35 in g_main_dispatch (context=0x67ad00) at gmain.c:3176
#25 g_main_context_dispatch (context=context@entry=0x67ad00) at gmain.c:3829
#26 0x0000003da164f1d8 in g_main_context_iterate (context=0x67ad00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3902
#27 0x0000003da164f4e2 in g_main_loop_run (loop=0x8acc10) at gmain.c:4098
#28 0x00007ffff76af385 in gtk_main () at gtkmain.c:1323
#29 0x0000000000409e73 in main (argc=<optimized out>, argv=<optimized out>) at main.c:313



xfce_appfinder_window_sort_items called with item contains NULL for XFCE_APPFINDER_MODEL_COLUMN_TITLE

l
1953      gtk_tree_model_get (model, b, XFCE_APPFINDER_MODEL_COLUMN_TITLE,
&title_b, -1);
1954      normalized = g_utf8_normalize (title_b, -1, G_NORMALIZE_ALL);
1955      title_b = g_utf8_casefold (normalized, -1);
1956      g_free (normalized);
Comment 1 Vitaly Lipatov 2018-09-02 22:00:07 CEST
Created attachment 7931 
Segfault is reproduced with this desktop file

Please, use attached desktop to reproduce the bug.
Comment 2 Andre Miranda editbugs 2018-09-04 04:05:06 CEST
The real problem is the desktop file that is not UTF-8, actually ISO-8859-1.
The specification[1] is not clear if other encodings are invalid, but in any case, segfaults are not acceptable.

Removing the part of code that crashes (comparison of entries for sorting), appfinder will output error messages similar to:
GLib-CRITICAL **: 22:44:29.097: g_utf8_collate: assertion 'str1 != NULL' failed

Whisker menu also display those messages and the broken app is "invisible" in menu, yet whisker doesn't crash. I think both applications expect UTF-8 from garcon, which is not the case...

I'll investigate in the next couple days what can be done, but I think that appfinder should completely ignore desktop files not encoded in UTF-8.

1- https://developer.gnome.org/desktop-entry-spec/
Comment 3 Vitaly Lipatov 2018-09-04 09:46:20 CEST
(In reply to Andre Miranda from comment #2)
...
> I think that appfinder should completely ignore desktop files not encoded in UTF-8.
+1
Comment 4 Mikhail Efremov 2018-09-04 18:06:38 CEST
Created attachment 7944 
Ignore-menu-items-without-name.patch

This patch is fixed the bug for me.
Apparently garcon_menu_item_get_name() can return NULL, so just don't add items with NULL names.
Comment 5 Git Bot editbugs 2018-09-07 03:58:14 CEST
Mikhail Efremov referenced this bugreport in commit 8df60d05073ec25b0ac4fd384ad34d5eb2d49459

Ignore menu items without name (Bug #14655)

https://git.xfce.org/xfce/xfce4-appfinder/commit?id=8df60d05073ec25b0ac4fd384ad34d5eb2d49459
Comment 6 Andre Miranda editbugs 2018-09-07 03:59:42 CEST
Thanks Mikhail, that's exactly what I had in mind.

Bug #14655

Reported by:
Vitaly Lipatov
Reported on: 2018-09-02
Last modified on: 2018-09-07

People

Assignee:
Andre Miranda
CC List:
2 users

Version

Version:
4.13.0

Attachments

Segfault is reproduced with this desktop file (309 bytes, application/x-desktop)
2018-09-02 22:00 CEST , Vitaly Lipatov
no flags
Ignore-menu-items-without-name.patch (894 bytes, patch)
2018-09-04 18:06 CEST , Mikhail Efremov
no flags

Additional information