! 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 !
Firefox process name and xfce taskmanager
Status:
RESOLVED: FIXED
Product:
Xfce4-taskmanager
Component:
General

Comments

Description bz 2018-01-17 21:33:30 CET
As some of you may have noticed since v54, Firefox has a long process string

`-contentproc -childID 1 -isForBrowser ...`

and in this long string there are also non utf-8 characters

This creates issue with xfce4-taskmanager, when it is open and there are some Firefox processes, it fills my journald with

    Invalid UTF-8 string passed to pango_layout_set_text()
Comment 1 Ivan 83 2018-05-27 03:13:46 CEST
Created attachment 7743 
normalize string
Comment 2 Landry Breuil editbugs 2018-05-27 11:19:40 CEST
The actual bug for firefox passing weird tons of parameters on the commandline has been fixed upstream in https://bugzilla.mozilla.org/show_bug.cgi?id=1373157 and https://bugzilla.mozilla.org/show_bug.cgi?id=1438678, but i agree that it's not nice for the taskmanager to not sanitize those strings. Will check Ivan's patch, thanks!
Comment 3 Landry Breuil editbugs 2018-05-27 11:41:20 CEST
The previous code replaced \r\n by a space, how are you handling this in the string cleaning ?
Comment 4 Landry Breuil editbugs 2018-05-27 11:43:57 CEST
Bah, stupid me, this is taken care of by g_strcanon() of course..
Comment 5 Git Bot editbugs 2018-05-27 12:01:12 CEST
Rozhuk Ivan referenced this bugreport in commit fd9e313e2e89ed0b81bec8c491842e7032e797ac

Make sure only printable characters are used in the pretty cmdline display (bug 14172)

https://git.xfce.org/apps/xfce4-taskmanager/commit?id=fd9e313e2e89ed0b81bec8c491842e7032e797ac
Comment 6 Landry Breuil editbugs 2018-05-27 12:01:35 CEST
Applied, thanks!
Comment 7 Mikhail Efremov 2018-06-13 19:18:45 CEST
Well, at least this patch fixes bug #10417 (I couldn 't reopen that bug, so 3 years ago I just added comment explaining why it is not fixed).
But now process with UTF-8 name will be invisible in the taskmanager because all non-ASCII characters will be replaced with spaces. I think proper solution will be to use g_unichar_isprint() for all UTF-8 characters.
Comment 8 Mikhail Efremov 2018-06-13 19:25:24 CEST
And once more again: g_strlcpy() can't be used for overlapping buffers.
Comment 9 Ivan 83 2018-07-29 08:24:10 CEST
Created attachment 7849 
more proper utf-8 string normalization
Comment 10 Git Bot editbugs 2018-08-02 08:49:07 CEST
rim referenced this bugreport in commit b89684865d88bbb8399f70387cae9e8ae17d64d9

Better utf-8 normalization (bug 14172)

https://git.xfce.org/apps/xfce4-taskmanager/commit?id=b89684865d88bbb8399f70387cae9e8ae17d64d9
Comment 11 Mikhail Efremov 2018-08-24 13:53:49 CEST
(In reply to Ivan 83 from comment #9)
> more proper utf-8 string normalization

Thanks, I tested this patch and it works for me as expected.
Comment 12 Landry Breuil editbugs 2018-12-09 09:57:19 CET
Ivan: fwiw, it seems the last commit (b89684865d88bbb8399f70387cae9e8ae17d64d9) introduces a memory corruption seen with valgrind:

==9038== Invalid read of size 2                                                                                                                                                                                                      
==9038==    at 0x4C36750: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)                                                                                                                                                   
==9038==    by 0x11C4A5: memmove (string_fortified.h:40)                                                                                                                                                                                     
==9038==    by 0x11C4A5: pretty_cmdline (task-manager.c:175)                                                                                                                                                                                 
==9038==    by 0x11C4A5: model_update_tree_iter (task-manager.c:270)                                                                                                                                                                         
==9038==    by 0x11CDD1: model_add_task (task-manager.c:206)                                                                                                                                                                                 
==9038==    by 0x11CDD1: xtm_task_manager_update_model (task-manager.c:496)                                                                                                                                                                  
==9038==    by 0x1120B7: init_timeout (main.c:149)                                                                                                                                                                                           
==9038==    by 0x111A66: main (main.c:241)                                                                                                                                                                                                   
==9038==  Address 0x13ded2d4 is 2 bytes after a block of size 18 alloc'd                                                                                                                                                                     
==9038==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)                                                                                                                                                    
==9038==    by 0x6D61578: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.1)                                                                                                                                                        
==9038==    by 0x6D7AAFE: g_strdup (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.1)                                                                                                                                                        
==9038==    by 0x11C333: pretty_cmdline (task-manager.c:130)
==9038==    by 0x11C333: model_update_tree_iter (task-manager.c:270)
==9038==    by 0x11CDD1: model_add_task (task-manager.c:206)
==9038==    by 0x11CDD1: xtm_task_manager_update_model (task-manager.c:496)
==9038==    by 0x1120B7: init_timeout (main.c:149)

==9038== Invalid read of size 8                                                                                                                                                                                                      
==9038==    at 0x4C367EE: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9038==    by 0x11C4A5: memmove (string_fortified.h:40)
==9038==    by 0x11C4A5: pretty_cmdline (task-manager.c:175)
==9038==    by 0x11C4A5: model_update_tree_iter (task-manager.c:270)
==9038==    by 0x11CDD1: model_add_task (task-manager.c:206)
==9038==    by 0x11CDD1: xtm_task_manager_update_model (task-manager.c:496)
==9038==    by 0x1120B7: init_timeout (main.c:149)
==9038==    by 0x111A66: main (main.c:241)
==9038==  Address 0x13bd14a8 is 2 bytes after a block of size 54 alloc'd
==9038==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9038==    by 0x6D61578: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.1)
==9038==    by 0x6D7AAFE: g_strdup (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.1)
==9038==    by 0x11C333: pretty_cmdline (task-manager.c:130)
==9038==    by 0x11C333: model_update_tree_iter (task-manager.c:270)
==9038==    by 0x11CDD1: model_add_task (task-manager.c:206)
==9038==    by 0x11CDD1: xtm_task_manager_update_model (task-manager.c:496)
==9038==    by 0x1120B7: init_timeout (main.c:149)
Comment 13 Mikhail Efremov 2018-12-11 18:34:34 CET
Created attachment 8174 
0001-Fix-mem-size-calculation-once-more.patch

Memory corruption fixed by commit b4266a20f869d0b57d9309e95b5c5c62f1a9912b, but a terminating null byte should be moved too.

Bug #14172

Reported by:
bz
Reported on: 2018-01-17
Last modified on: 2018-12-11

People

Assignee:
Mike Massonnet
CC List:
3 users

Version

Attachments

Additional information