On Wed, Jul 01, 2020 at 09:29:25PM +0200, joris.k...@gmail.com wrote:
> From: Joris Klaasse Bos <joris.k...@gmail.com>
> 
> Before this commit, running st on a system with musl libc would
> result in a segmentation fault. This is because musl implements
> locales differently, which means the function
> Xutf8TextListToTextProperty would fail, because the locale isn't
> supported, leading to nonexistent memory being freed.
> 
> I've fixed this by checking if the locale is supported and using
> XStringListToTextProperty otherwise.
> ---
>  x.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/x.c b/x.c
> index 210f184..a9632cb 100644
> --- a/x.c
> +++ b/x.c
> @@ -1585,8 +1585,11 @@ xsettitle(char *p)
>       XTextProperty prop;
>       DEFAULT(p, opt_title);
>  
> -     Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
> -                     &prop);
> +     if (XSupportsLocale())
> +             Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
> +                             &prop);
> +     else
> +             XStringListToTextProperty(&p, 1, &prop);
>       XSetWMName(xw.dpy, xw.win, &prop);
>       XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname);
>       XFree(prop.value);
> -- 
> 2.27.0
> 
> 

Hi,

Just tested it on Voidlinux musl and don't see an issue here.

What locale are you using? Can you post the output of locale?

Can you provide more details of your system / setup and possibly a simple
command to reproduce the issue more easily and cause a crash?

-- 
Kind regards,
Hiltjo

Reply via email to