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

[BUG] - Panic at parsing specific 11 digit strings #32

Closed
igorkova opened this issue Jun 12, 2023 · 1 comment
Closed

[BUG] - Panic at parsing specific 11 digit strings #32

igorkova opened this issue Jun 12, 2023 · 1 comment
Labels

Comments

@igorkova
Copy link

Context

personnummer.Valid("19000011111")

Expected outcome

false

Actual outcome

panic

Description

Looks like all 11 digit inputs are panicking.

I am not sure about all the details regarding the length of PN, coordination number and interim numbers but it feels like we could do a check on the length and make sure that we are dealing with 10 or 12 digits at all times?
I see we have length check already for == 0 and < 8 https://github.com/personnummer/go/blob/master/personnummer.go#L214 which discourages me to put 10/12 check as it's unclear why 9 would be OK.

Minimal reproducible test case

@igorkova igorkova added the bug label Jun 12, 2023
frozzare added a commit that referenced this issue Jun 12, 2023
@frozzare
Copy link
Member

Thanks, you're right. I've fixed this before you're pull request since I've could remove some code and move around some code to make it work without the if.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants