Bug#944372: What more can be done?

2021-05-26 Thread Jochen Betz
The issue is still pending and I don't see any reply from the maintainer.

What more than providing even the patch for the issue can be done to get
this thing moving forward?


-- 
Dipl.-Ing. Jochen Betz
jochen.b...@gmx.net



signature.asc
Description: OpenPGP digital signature


Bug#944372: Segfault due to nullpointer duplication due to empty LC_ALL

2020-11-13 Thread Jochen Betz
I'm still facing the same issue. Further investigations showed the cause
for the segfault due to absolutely no checking for null pointers. Thus
it fails when trying to duplicate a string with mc_strdup().

Further check shows that it fails to locale definition of LC_ALL=
without any value, which AFAIK is a kind of default, at least on debian
or on my system.

> $ locale
> LANG=en_US.utf8
> LANGUAGE=en_US:en
> LC_CTYPE=en_US.utf8
> LC_NUMERIC=de_DE.utf8
> LC_TIME=de_DE.utf8
> LC_COLLATE=en_US.utf8
> LC_MONETARY=de_DE.utf8
> LC_MESSAGES=en_US.utf8
> LC_PAPER=de_DE.utf8
> LC_NAME=de_DE.utf8
> LC_ADDRESS=de_DE.utf8
> LC_TELEPHONE=de_DE.utf8
> LC_MEASUREMENT=de_DE.utf8
> LC_IDENTIFICATION=de_DE.utf8
> LC_ALL=

This is not accounted for in the code of check of the character set

> char *
> util_get_charset (void)
> {
>   char *charset;
> 
>   if (mailvar_get (&charset, "charset", mailvar_type_string, 0))
> return NULL;
> 
>   if (mu_c_strcasecmp (charset, "auto") == 0)
> {
>   struct mu_lc_all lc_all = { .flags = 0 };
>   char *tmp = getenv ("LC_ALL");
>   if (!tmp)
>   tmp = getenv ("LANG");
>   
>   if (tmp && mu_parse_lc_all (tmp, &lc_all, MU_LC_CSET) == 0)
>   {
> charset = mu_strdup (lc_all.charset);
> mu_lc_all_free (&lc_all);
>   }
>   else
>   charset = NULL;
> }
>   else
> charset = mu_strdup (charset);
> 
>   return charset;
> }

Thus a patch would be to add a check for empty string of LC_ALL

>   if ((!tmp) | ((tmp != NULL) & (strlen(tmp) == 0)) )
>   tmp = getenv ("LANG");


I don't know if this is the best way how to fix this issue. But having a
LC_ALL which is empty seems to be valid for me.



-- 
Dipl.-Ing. Jochen Betz
jochen.b...@gmx.net
--- org.c	2020-11-13 12:48:03.489782343 +0100
+++ patched.c	2020-11-13 12:46:56.616695250 +0100
@@ -1059,7 +1059,7 @@
 {
   struct mu_lc_all lc_all = { .flags = 0 };
   char *tmp = getenv ("LC_ALL");
-  if (!tmp)
+  if ((!tmp) | ((tmp != NULL) & (strlen(tmp) == 0)) )
 	tmp = getenv ("LANG");
   
   if (tmp && mu_parse_lc_all (tmp, &lc_all, MU_LC_CSET) == 0)


signature.asc
Description: OpenPGP digital signature


Bug#944372: Backtrace

2020-11-06 Thread Jochen Betz
Hi still experience the same issue. To me it seems that it has problems
parsing/handling the mail file in /var/mail/USERNAME. As long as it is
empty, it does not fail.
As soon as it contains something... segfault!

The following is a stack trace I could gather:


[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
"/var/mail/jochen": 1 message 1 new

Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
65  ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or
directory.
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
#1  0x775e0dae in __GI___strdup (s=0x0) at strdup.c:41
#2  0x77a43b5f in mu_strdup (s=0x0) at alloc.c:77
#3  0x55576818 in util_get_charset () at util.c:1067
#4  0x55576891 in util_rfc2047_decode (value=0x7fffb248) at
util.c:1087
#5  0x555657f9 in hdr_from (args=0x7fffb2e0, data=0x0) at
from.c:273
#6  0x5556518d in format_headline (seg=0x555a39f0,
mspec=0x7fffb370, msg=0x555b0280) at from.c:97
#7  0x555664c3 in mail_from0 (mspec=0x7fffb370,
msg=0x555b0280, data=0x0) at from.c:609
#8  0x5556db95 in page_do (func=0x55566495 ,
data=0x0) at page.c:178
#9  0x55566537 in mail_headers (argc=1, argv=0x555b0c28) at
headers.c:35
#10 0x5557462f in util_do_command (fmt=0x55578eca "headers")
at util.c:143
#11 0x55567d0d in main (argc=0, argv=0x7fffb7b0) at mail.c:654
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
No locals.
#1  0x775e0dae in __GI___strdup (s=0x0) at strdup.c:41
len = 
new = 
#2  0x77a43b5f in mu_strdup (s=0x0) at alloc.c:77
news = 0x0
#3  0x55576818 in util_get_charset () at util.c:1067
lc_all = {flags = 0, language = 0x0, territory = 0x0, charset =
0x0, modifier = 0x0}
tmp = 0x7fffee86 ""
charset = 0x55588b70 "auto"
#4  0x55576891 in util_rfc2047_decode (value=0x7fffb248) at
util.c:1087
charset = 0x7fffb280 "\020\263\377\377\377\177"
tmp = 0x77a5ee63 
"H\213E\370H\211E\360H\203", 
rc = 0
#5  0x555657f9 in hdr_from (args=0x7fffb2e0, data=0x0) at
from.c:273
hdr = 0x555b2140
from = 0x5558fe00 "jochen"
#6  0x5556518d in format_headline (seg=0x555a39f0,
mspec=0x7fffb370, msg=0x555b0280) at from.c:97
width = 1
len = 1
cols_rest = 181
p = 0x55589870 " "
screen_cols = 188
out_cols = 7
args = {mspec = 0x7fffb370, msg = 0x555b0280, cols_rest
= 181, buf = 0x55591660 "1", size = 2}
#7  0x555664c3 in mail_from0 (mspec=0x7fffb370,
msg=0x555b0280, data=0x0) at from.c:609
No locals.
#8  0x5556db95 in page_do (func=0x55566495 ,
data=0x0) at page.c:178
msg = 0x555b0280
set = {next = 0x0, npart = 1, msg_part = 0x555a3250}
i = 0
#9  0x55566537 in mail_headers (argc=1, argv=0x555b0c28) at
headers.c:35
No locals.
#10 0x5557462f in util_do_command (fmt=0x55578eca "headers")
at util.c:143
ws = {ws_wordc = 1, ws_wordv = 0x555b0c20, ws_offs = 1,
ws_wordn = 128, ws_flags = 33558086, ws_options = 1632, ws_delim =
0x77ad6e9e " \t\n", ws_comment = 0x0, ws_escape = {0x77af6360
 "\"\"a\ab\bf\fn\nr\rt\tv\v",
0x77af6360 
"\"\"a\ab\bf\fn\nr\rt\tv\v"}, ws_alloc_die = 0x77ab20d8
<_wsplt_alloc_die>, ws_error = 0x77ab2116 <_wsplt_error>, ws_debug =
0x55585fd8 , ws_env = 0x1, ws_envbuf = 0x555ad430,
ws_envidx = 483314001, ws_envsiz = 0, ws_getvar = 0x1, ws_closure = 0x0,
ws_command = 0x0, ws_input = 0x555b09e0 "@\"[UUU", ws_len = 7,
ws_endp = 7, ws_errno = 0, ws_usererr = 0x555799b6 "header", ws_head
= 0x0, ws_tail = 0x0, ws_lvl = 0}
argc = 1
argv = 0x555b0c28
status = 0
entry = 0x55582500 
cmd = 0x555b09e0 "@\"[UUU"
size = 512
ap = {{gp_offset = 8, fp_offset = 48, overflow_arg_area =
0x7fffb5d0, reg_save_area = 0x7fffb500}}
#11 0x55567d0d in main (argc=0, argv=0x7fffb7b0) at mail.c:654
mode = 0x55589f60 "read"
prompt = 0x0
p = 0x555a35c7 "/home/jochen/.mailrc"
i = 56
rc = 0

Thread 1 (Thread 0x76739980 (LWP 7076)):
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
No locals.
#1  0x775e0dae in __GI___strdup (s=0x0) at strdup.c:41
len = 
new = 
#2  0x77a43b5f in mu_strdup (s=0x0) at alloc.c:77
news = 0x0
#3  0x55576818 in util_get_charset () at util.c:1067
lc_all = {flags = 0, language = 0x0, territory = 0x0, charset =
0x0, modifier = 0x0}
tmp = 0x7fffee86 ""
charset = 0x55588b70 "auto"
#4  0x5