diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-19 06:42:22 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-19 06:42:22 +0000 |
commit | cfd3e6cc939d8bde13484fe44765049dcaa49dc2 (patch) | |
tree | 1b3d87730118630502a5e7ba95045e4401b25fb3 /util.c | |
parent | b76347f2eb34c85a0a38543b2f57ca474fedab4d (diff) | |
download | perl-cfd3e6cc939d8bde13484fe44765049dcaa49dc2.tar.gz |
Make hex scanning warn on "\x{x}" and "\xx".
"\x" and and hex("x") are still valid.
p4raw-id: //depot/perl@7746
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -3094,10 +3094,20 @@ Perl_scan_hex(pTHX_ char *start, STRLEN len, STRLEN *retlen) register char *s = start; register NV rnv = 0.0; register UV ruv = 0; - register bool seenx = FALSE; register bool overflowed = FALSE; char *hexdigit; + if (len > 2) { + if (s[0] == 'x') { + s++; + len--; + } + else if (len > 3 && s[0] == '0' && s[1] == 'x') { + s+=2; + len-=2; + } + } + for (; len-- && *s; s++) { hexdigit = strchr((char *) PL_hexdigit, *s); if (!hexdigit) { @@ -3107,11 +3117,6 @@ Perl_scan_hex(pTHX_ char *start, STRLEN len, STRLEN *retlen) --len; ++s; } - else if (seenx == FALSE && *s == 'x' && ruv == 0) { - /* Disallow 0xxx0x0xxx... */ - seenx = TRUE; - continue; - } else { dTHR; if (ckWARN(WARN_DIGIT)) |