From: Jarkko Hietaniemi Date: Sun, 26 Nov 2000 18:11:02 +0000 (+0000) Subject: Fix locale inconsistencies unearthed by Hugo's work. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6413315113862034a32b9a6420bf5084246e36ce;p=p5sagit%2Fp5-mst-13.2.git Fix locale inconsistencies unearthed by Hugo's work. Now the floating point sprintf really does taint the result string as perllocale promises (has promised for a long time) if "use locale" is in the lexical scope. p4raw-id: //depot/perl@7863 --- diff --git a/sv.c b/sv.c index 5e18582..1720101 100644 --- a/sv.c +++ b/sv.c @@ -6623,6 +6623,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV *--eptr = '%'; (void)sprintf(PL_efloatbuf, eptr, nv); +#ifdef USE_LOCALE_NUMERIC + if ((PL_hints & HINT_LOCALE) && maybe_tainted) + *maybe_tainted = TRUE; +#endif eptr = PL_efloatbuf; elen = strlen(PL_efloatbuf); diff --git a/t/pragma/locale.t b/t/pragma/locale.t index a1ec7a1..89fb4e8 100755 --- a/t/pragma/locale.t +++ b/t/pragma/locale.t @@ -80,9 +80,9 @@ check_taint 7, "\L$a"; check_taint 8, lcfirst($a); check_taint 9, "\l$a"; -check_taint_not 10, sprintf('%e', 123.456); -check_taint_not 11, sprintf('%f', 123.456); -check_taint_not 12, sprintf('%g', 123.456); +check_taint 10, sprintf('%e', 123.456); +check_taint 11, sprintf('%f', 123.456); +check_taint 12, sprintf('%g', 123.456); check_taint_not 13, sprintf('%d', 123.456); check_taint_not 14, sprintf('%x', 123.456);