diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-27 12:42:43 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-27 12:42:43 +0000 |
commit | 252aa0820e6bce274b33bd342cfc65e18a59a165 (patch) | |
tree | 1806e58de44b0a99806e6393ef563649f1e42438 /pp.c | |
parent | 2cc242586845107754f99fa3e09637c9a344d545 (diff) | |
download | perl-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.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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; } |