diff options
| author | dgp <dgp@users.sourceforge.net> | 2016-10-12 13:42:40 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2016-10-12 13:42:40 (GMT) |
| commit | 36825d23b9c7e3ff2280b290ba62491aaa76fee6 (patch) | |
| tree | b9d02e375cc98b49355cafc7e7bdb67704ab859b | |
| parent | ec64cc0418e1c7f9c547f3dae821c21d4bdad383 (diff) | |
| parent | 326e0a8fdf312bb1823539ec064b5ecacb3dac58 (diff) | |
| download | tcl-36825d23b9c7e3ff2280b290ba62491aaa76fee6.zip tcl-36825d23b9c7e3ff2280b290ba62491aaa76fee6.tar.gz tcl-36825d23b9c7e3ff2280b290ba62491aaa76fee6.tar.bz2 | |
[be003d570f] TclParseNumber() failed to fully implement TCL_PARSE_OCTAL_ONLY.
| -rw-r--r-- | generic/tclStrToD.c | 9 | ||||
| -rw-r--r-- | tests/scan.test | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index f69f6b9..dc85124 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -396,6 +396,9 @@ static Tcl_WideUInt Nokia770Twiddle(Tcl_WideUInt w); * - TCL_PARSE_SCAN_PREFIXES: ignore the prefixes 0b and 0o that are * not part of the [scan] command's vocabulary. Use only in * combination with TCL_PARSE_INTEGER_ONLY. + * - TCL_PARSE_BINARY_ONLY: parse only in the binary format, whether + * or not a prefix is present that would lead to binary parsing. + * Use only in combination with TCL_PARSE_INTEGER_ONLY. * - TCL_PARSE_OCTAL_ONLY: parse only in the octal format, whether * or not a prefix is present that would lead to octal parsing. * Use only in combination with TCL_PARSE_INTEGER_ONLY. @@ -627,6 +630,9 @@ TclParseNumber( acceptPoint = p; acceptLen = len; if (c == 'x' || c == 'X') { + if (flags & TCL_PARSE_OCTAL_ONLY) { + goto endgame; + } state = ZERO_X; break; } @@ -637,6 +643,9 @@ TclParseNumber( goto zeroo; } if (c == 'b' || c == 'B') { + if (flags & TCL_PARSE_OCTAL_ONLY) { + goto endgame; + } state = ZERO_B; break; } diff --git a/tests/scan.test b/tests/scan.test index b57b641..d814ce9 100644 --- a/tests/scan.test +++ b/tests/scan.test @@ -535,6 +535,9 @@ test scan-5.13 {integer scanning and overflow} { test scan-5.14 {integer scanning} { scan 0xff %u } 0 +test scan-5.15 {Bug be003d570f} { + scan 0x40 %o +} 0 test scan-6.1 {floating-point scanning} -setup { set a {}; set b {}; set c {}; set d {} |
