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

BigInteger parses invalid strings #152

Closed
fullkomnun opened this issue Feb 9, 2021 · 0 comments
Closed

BigInteger parses invalid strings #152

fullkomnun opened this issue Feb 9, 2021 · 0 comments
Assignees

Comments

@fullkomnun
Copy link
Contributor

fullkomnun commented Feb 9, 2021

Describe the bug
When trying to parse invalid strings using BigInteger::parseString it often parses the string successfully
into a numeric value while java's BigInteger throws NumberFormatException

To Reproduce
Steps to reproduce the behavior:
Invoke BigInteger.parseString("a") or BigInteger.parseString("a", 10) both return "10" same as if we invoke BigInteger.parseString("a", 16)

Expected behavior
Java's BigInteger throws NumberFormatException for java.math.BigInteger("a") but parses successfully for java.math.BigInteger("a", 16)

Platform

  • JVM

Additional context
Might be relevant for more use-cases of invalid string values.
Might be worth to verify for parsing invalid strings with BigDecimal.

@ionspin ionspin self-assigned this Feb 10, 2021
ionspin added a commit that referenced this issue Feb 11, 2021
Check for base, and check if character belongs to base. Fixes #152
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

2 participants