diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-12-11 12:54:14 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-12-11 12:54:14 +0000 |
commit | 7ad96abb1ad587ddcec56cda2faec929c6a20956 (patch) | |
tree | 9242e874bfa8c276d5b48222292e6f8316ba55e5 /sv.c | |
parent | a7a23d71702876705a62edb89b892fca62cd448b (diff) | |
download | perl-7ad96abb1ad587ddcec56cda2faec929c6a20956.tar.gz |
Quench the other 2 ways obscure ways of abusing positional parameters
to generate bogus array indexes. These two are inside the vector
formatting code.
p4raw-id: //depot/perl@26320
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -7977,9 +7977,12 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV if (vectorarg) { if (args) vecsv = va_arg(*args, SV*); - else - vecsv = (evix ? evix <= svmax : svix < svmax) ? - svargs[evix ? evix-1 : svix++] : &PL_sv_undef; + else if (evix) { + vecsv = (evix > 0 && evix <= svmax) + ? svargs[evix-1] : &PL_sv_undef; + } else { + vecsv = svix < svmax ? svargs[svix++] : &PL_sv_undef; + } dotstr = SvPV_const(vecsv, dotstrlen); if (DO_UTF8(vecsv)) is_utf8 = TRUE; @@ -7987,7 +7990,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV if (args) { VECTORIZE_ARGS } - else if (efix ? efix <= svmax : svix < svmax) { + else if (efix ? (efix > 0 && efix <= svmax) : svix < svmax) { vecsv = svargs[efix ? efix-1 : svix++]; vecstr = (U8*)SvPV_const(vecsv,veclen); vec_utf8 = DO_UTF8(vecsv); |