Skip to content

ensure locale_name_on_entry isn't clobbered #17217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion t/porting/customized.dat
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ autodie cpan/autodie/t/mkdir.t 9e70d2282a3cc7d76a78bf8144fccba20fb37dac
autodie cpan/autodie/t/recv.t 63bea2daa330e44b67714527ddf701c1bf3a6954
experimental cpan/experimental/t/basic.t cb9da8dd05b854375809872a05dd32637508d5da
version cpan/version/lib/version.pm 7ef9219d1d5f1d71f08a79f3b0577df138b21b12
version vutil.c 317c25a807f9503282d58917a4a53b667232a6c5
version vutil.c 601cc57bbc0070ae33eab7fd2d667f20efbe15f8
6 changes: 6 additions & 0 deletions vutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)
if ( strNE(locale_name_on_entry, "C")
&& strNE(locale_name_on_entry, "POSIX"))
{
/* the setlocale() call might free or overwrite the name */
locale_name_on_entry = savepv(locale_name_on_entry);
setlocale(LC_NUMERIC, "C");
}
else { /* This value indicates to the restore code that we didn't
Expand All @@ -666,6 +668,8 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)
if ( strNE(locale_name_on_entry, "C")
&& strNE(locale_name_on_entry, "POSIX"))
{
/* the setlocale() call might free or overwrite the name */
locale_name_on_entry = savepv(locale_name_on_entry);
setlocale(LC_NUMERIC, "C");
}
else { /* This value indicates to the restore code that we
Expand Down Expand Up @@ -715,6 +719,7 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)

if (locale_name_on_entry) {
setlocale(LC_NUMERIC, locale_name_on_entry);
Safefree(locale_name_on_entry);
}

LC_NUMERIC_UNLOCK; /* End critical section */
Expand All @@ -723,6 +728,7 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)

if (locale_name_on_entry) {
setlocale(LC_NUMERIC, locale_name_on_entry);
Safefree(locale_name_on_entry);
LC_NUMERIC_UNLOCK;
}
else if (locale_obj_on_entry == PL_underlying_numeric_obj) {
Expand Down