develooper Front page | perl.perl5.porters | Postings from June 2019

Re: [perl #134182] Fix test failure in POSIX/t/mb.t with semi-brokenlocales

Thread Previous | Thread Next
From:
Niko Tyni
Date:
June 17, 2019 16:20
Subject:
Re: [perl #134182] Fix test failure in POSIX/t/mb.t with semi-brokenlocales
Message ID:
20190617162032.GA9022@estella.local.invalid
On Mon, Jun 17, 2019 at 02:49:43PM +0300, Niko Tyni wrote:
> On Mon, Jun 17, 2019 at 09:47:04AM +0300, Niko Tyni wrote:
> 
> > I can reproduce it on 5.30.0. It seems to be related to version strings
> > and LC_NUMERIC.  I reduced it to this:
> > 
> > $ LC_NUMERIC=C.UTF-8 ./perl -l -Ilib -e 'require 5.006;'
> 
> And further to this. It's not clear to me if this is a problem with asan
> or the code.
> 
> $ cat t.c; clang -g -fsanitize=address t.c; ./a.out
> #include <locale.h>
> int main(void) {
>     char *l;
>     setlocale(LC_NUMERIC, "C.UTF-8");
>     l = setlocale(LC_NUMERIC, NULL);
>     setlocale(LC_NUMERIC, "C");
>     setlocale(LC_NUMERIC, l);
> }

Presumably the intervening setlocale() call clobbers the buffer
that l points to.

The attached patch to vutil.c seems to fix this issue for me,
but eyeballs appreciated of course.
-- 
Niko

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About