decode: error on _ before exponent in floats (#647)

Fixes #646
This commit is contained in:
Thomas Pelletier
2021-10-28 20:41:10 -04:00
committed by GitHub
parent 19751e8a51
commit 3694ae88f6
2 changed files with 21 additions and 4 deletions
+3
View File
@@ -405,6 +405,9 @@ func checkAndRemoveUnderscoresFloats(b []byte) ([]byte, error) {
if !before {
return nil, newDecodeError(b[i-1:i+1], "number must have at least one digit between underscores")
}
if i < len(b)-1 && (b[i+1] == 'e' || b[i+1] == 'E') {
return nil, newDecodeError(b[i+1:i+2], "cannot have underscore before exponent")
}
before = false
case 'e', 'E':
if i < len(b)-1 && b[i+1] == '_' {