summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-07-27 12:42:43 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-07-27 12:42:43 +0000
commit252aa0820e6bce274b33bd342cfc65e18a59a165 (patch)
tree1806e58de44b0a99806e6393ef563649f1e42438 /pp.c
parent2cc242586845107754f99fa3e09637c9a344d545 (diff)
downloadperl-252aa0820e6bce274b33bd342cfc65e18a59a165.tar.gz
Integer constants (0x, 0[0-7], 0b) now overflow fatally,
they used to be just optional lexical warnings. Also, with warnings turned on, constants > 2**32-1 trigger a non-portability warning. p4raw-id: //depot/cfgperl@3798
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/pp.c b/pp.c
index 69d3795ee4..770b07d8bb 100644
--- a/pp.c
+++ b/pp.c
@@ -1885,7 +1885,7 @@ PP(pp_hex)
STRLEN n_a;
tmps = POPpx;
- XPUSHu(scan_hex(tmps, 99, &argtype));
+ XPUSHu(scan_hex(tmps, sizeof(UV) * 2 + 1, &argtype));
RETURN;
}
@@ -1900,14 +1900,14 @@ PP(pp_oct)
tmps = POPpx;
while (*tmps && isSPACE(*tmps))
tmps++;
- if (*tmps == '0')
- tmps++;
- if (*tmps == 'x')
- value = scan_hex(++tmps, 99, &argtype);
- else if (*tmps == 'b')
- value = scan_bin(++tmps, 99, &argtype);
+ /* Do not eat the leading 0[bx] because we need them
+ * to detect malformed binary and hexadecimal numbers. */
+ if ((tmps[0] == '0' && tmps[1] == 'x') || tmps[0] == 'x')
+ value = scan_hex(tmps, sizeof(UV) * 2 + 1, &argtype);
+ else if ((tmps[0] == '0' && tmps[1] == 'b') || tmps[0] == 'b')
+ value = scan_bin(tmps, sizeof(UV) * 8 + 1, &argtype);
else
- value = scan_oct(tmps, 99, &argtype);
+ value = scan_oct(tmps, sizeof(UV) * 4 + 1, &argtype);
XPUSHu(value);
RETURN;
}