summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/util.c b/util.c
index 2168d55ee6..02d0ed52f5 100644
--- a/util.c
+++ b/util.c
@@ -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))