Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strconv: ParseComplex fails to accept "0_0+0x_0p0i" #38962

Closed
griesemer opened this issue May 8, 2020 · 1 comment
Closed

strconv: ParseComplex fails to accept "0_0+0x_0p0i" #38962

griesemer opened this issue May 8, 2020 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@griesemer
Copy link
Contributor

Reproducer:

package main

import "fmt"
import "strconv"

func main() {
	x, err := strconv.ParseComplex("0_0+0x_0p0i", 128)
	if err != nil {
		panic(err)
	}
	fmt.Println(x)
}

We just added function ParseComplex to strconv so this is a release blocker.

The problem is in readFloat where we check for underscoreOk for the whole string rather than only the string read so far (atof.go:303).

Fix is trivial, need more tests.

@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels May 8, 2020
@griesemer griesemer added this to the Go1.15 milestone May 8, 2020
@griesemer griesemer self-assigned this May 8, 2020
@gopherbot
Copy link

Change https://golang.org/cl/233017 mentions this issue: strconv: fix ParseComplex for strings with separators

@golang golang locked and limited conversation to collaborators May 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants