Decode: ensure signed exponents don't start with an underscore (#699)

This commit is contained in:
Cameron Moore
2021-12-05 19:02:19 -06:00
committed by GitHub
parent b37e11d74d
commit 8bbb519477
2 changed files with 12 additions and 0 deletions
+4
View File
@@ -465,6 +465,10 @@ func checkAndRemoveUnderscoresFloats(b []byte) ([]byte, error) {
return nil, newDecodeError(b[i+1:i+2], "cannot have underscore before exponent")
}
before = false
case '+', '-':
// signed exponents
cleaned = append(cleaned, c)
before = false
case 'e', 'E':
if i < len(b)-1 && b[i+1] == '_' {
return nil, newDecodeError(b[i+1:i+2], "cannot have underscore after exponent")