diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-07-09 17:27:35 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-07-09 17:27:35 +0000 |
commit | 3e884cbfde531bbaf80ff3ded5ed1ee9b9a9f16e (patch) | |
tree | 3db853238b87e9a6d1d335d2ce97f74cf92d1b38 /toke.c | |
parent | f9655257b2ff49a04bcf20c32c0590f5bc23526e (diff) | |
download | perl-3e884cbfde531bbaf80ff3ded5ed1ee9b9a9f16e.tar.gz |
Fix for the 'print v65' plus safety tweaks from Rafael.
p4raw-id: //depot/perl@20097
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -7978,15 +7978,14 @@ Perl_scan_vstring(pTHX_ char *s, SV *sv) char *pos = s; char *start = s; if (*pos == 'v') pos++; /* get past 'v' */ - while (isDIGIT(*pos) || *pos == '_') - pos++; + while (pos < PL_bufend && (isDIGIT(*pos) || *pos == '_')) + pos++; if ( *pos != '.') { /* this may not be a v-string if followed by => */ start = pos; - if (isSPACE(*start)) - start = skipspace(start); - if ( *start == '=' && start[1] == '>' ) - { + while (start < PL_bufend && isSPACE(*start)) + ++start; + if ((PL_bufend - start) >= 2 && *start == '=' && start[1] == '>' ) { /* return string not v-string */ sv_setpvn(sv,(char *)s,pos-s); return pos; @@ -8029,13 +8028,13 @@ Perl_scan_vstring(pTHX_ char *s, SV *sv) sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf); if (!UNI_IS_INVARIANT(NATIVE_TO_UNI(rev))) SvUTF8_on(sv); - if (*pos == '.' && isDIGIT(pos[1])) + if (pos + 1 < PL_bufend && *pos == '.' && isDIGIT(pos[1])) s = ++pos; else { s = pos; break; } - while (isDIGIT(*pos) || *pos == '_') + while (pos < PL_bufend && (isDIGIT(*pos) || *pos == '_')) pos++; } SvPOK_on(sv); |