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

parseField does not range-check for Word16 #211

Open
jchia opened this issue May 10, 2022 · 0 comments
Open

parseField does not range-check for Word16 #211

jchia opened this issue May 10, 2022 · 0 comments

Comments

@jchia
Copy link

jchia commented May 10, 2022

There is an instance of ParseField for Word16 and I was expecting it to fail for an input of "65536" because it is out-of-range.

I was surprised to find out that "65536" parses as 0:

ghci> runParser $ parseField @Word16 "65536"
Right 0

I think parseField on bounded integral types should do the necessary range-checking. The parseField for Word16 currently uses decimal from attoparsec, which does not do range checking. This issue affects different bounded integral types, not just Word16.

Related attoparsec issue: haskell/attoparsec#211

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

No branches or pull requests

1 participant