summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-12-11 12:54:14 +0000
committerNicholas Clark <nick@ccl4.org>2005-12-11 12:54:14 +0000
commit7ad96abb1ad587ddcec56cda2faec929c6a20956 (patch)
tree9242e874bfa8c276d5b48222292e6f8316ba55e5 /sv.c
parenta7a23d71702876705a62edb89b892fca62cd448b (diff)
downloadperl-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.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index 19a2ce74c0..fc2540d8e0 100644
--- a/sv.c
+++ b/sv.c
@@ -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);