mirror of
https://github.com/golang/go
synced 2024-11-18 08:14:41 -07:00
go/scanner: recognize invalid floating-point constant exponent
Fixes #17621. Change-Id: Id3e75c9b7fba2cf8e791c8817f890556ca238e9d Reviewed-on: https://go-review.googlesource.com/32096 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
4b2665786e
commit
3cfc757c62
@ -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"},
|
||||
|
Loading…
Reference in New Issue
Block a user