diff options
author | Gisle Aas <gisle@aas.no> | 1998-10-16 18:33:12 +0200 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-25 05:07:42 +0000 |
commit | e3fdf9887934783dd5692982e11c048eb7c97265 (patch) | |
tree | 55fe2157c576fa4f940673716fe3667a84b80b3c | |
parent | b03b9beb4aad24925326d26b7ad4ddf7ed2dbfea (diff) | |
download | perl-e3fdf9887934783dd5692982e11c048eb7c97265.tar.gz |
disallow 'x' in hex numbers (except leading '0x')
Message-ID: <m3n26wtw47.fsf@furu.g.aas.no>
Subject: Re: [PATCH 5.005_52] 'x' is not a legal hex digit
p4raw-id: //depot/perl@2054
-rw-r--r-- | perlvars.h | 2 | ||||
-rwxr-xr-x | t/op/oct.t | 5 | ||||
-rw-r--r-- | util.c | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/perlvars.h b/perlvars.h index c79c37de3e..d42353df51 100644 --- a/perlvars.h +++ b/perlvars.h @@ -194,7 +194,7 @@ PERLVAR(Glast_swash_slen, STRLEN) /* constants (these are not literals to facilitate pointer comparisons) */ PERLVARIC(GYes, char *, "1") PERLVARIC(GNo, char *, "") -PERLVARIC(Ghexdigit, char *, "0123456789abcdef0123456789ABCDEFx") +PERLVARIC(Ghexdigit, char *, "0123456789abcdef0123456789ABCDEF") PERLVARIC(Gpatleave, char *, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}") PERLVAR(Gspecialsv_list[4],SV *) /* from byterun.h */ diff --git a/t/op/oct.t b/t/op/oct.t index 24b5c4309d..66230898ab 100755 --- a/t/op/oct.t +++ b/t/op/oct.t @@ -1,8 +1,6 @@ #!./perl -# $RCSfile: oct.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:08 $ - -print "1..8\n"; +print "1..9\n"; print +(oct('01234') == 01234) ? "ok" : "not ok", " 1\n"; print +(oct('0x1234') == 0x1234) ? "ok" : "not ok", " 2\n"; @@ -12,3 +10,4 @@ print +(oct('x80000000') == 0x80000000) ? "ok" : "not ok", " 5\n"; print +(hex('80000000') == 0x80000000) ? "ok" : "not ok", " 6\n"; print +(oct('1234') == 668) ? "ok" : "not ok", " 7\n"; print +(hex('1234') == 4660) ? "ok" : "not ok", " 8\n"; +print +(hex('0x1234') == 0x1234) ? "ok" : "not ok", " 9\n"; @@ -2451,7 +2451,7 @@ scan_hex(char *start, I32 len, I32 *retlen) while (len-- && *s) { tmp = strchr((char *) PL_hexdigit, *s++); if (!tmp) { - if (*(s-1) == '_') + if (*(s-1) == '_' || (*(s-1) == 'x' && retval == 0)) continue; else { dTHR; |