Commit 3cfc757c authored by Robert Griesemer's avatar Robert Griesemer

go/scanner: recognize invalid floating-point constant exponent

Fixes #17621.

Change-Id: Id3e75c9b7fba2cf8e791c8817f890556ca238e9d
Reviewed-on: https://go-review.googlesource.com/32096Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
parent 4b266578
......@@ -349,7 +349,11 @@ exponent:
if s.ch == '-' || s.ch == '+' {
s.next()
}
s.scanMantissa(10)
if digitVal(s.ch) < 10 {
s.scanMantissa(10)
} else {
s.error(offs, "illegal floating-point exponent")
}
}
if s.ch == 'i' {
......
......@@ -717,6 +717,7 @@ var errors = []struct {
{"078.", token.FLOAT, 0, "078.", ""},
{"07801234567.", token.FLOAT, 0, "07801234567.", ""},
{"078e0", token.FLOAT, 0, "078e0", ""},
{"0E", token.FLOAT, 0, "0E", "illegal floating-point exponent"}, // issue 17621
{"078", token.INT, 0, "078", "illegal octal number"},
{"07800000009", token.INT, 0, "07800000009", "illegal octal number"},
{"0x", token.INT, 0, "0x", "illegal hexadecimal number"},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment