The Wayback Machine - https://web.archive.org/web/20200608230105/https://github.com/TheAlgorithms/Java/issues/1345
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

StringIndexOutOfBoundsException in Java/Maths/ParseInteger.java #1345

Open
pointhi opened this issue Jun 8, 2020 · 0 comments
Open

StringIndexOutOfBoundsException in Java/Maths/ParseInteger.java #1345

pointhi opened this issue Jun 8, 2020 · 0 comments

Comments

@pointhi
Copy link

@pointhi pointhi commented Jun 8, 2020

The function parseInt has a missing size check. This leads to a StringIndexOutOfBoundsException with the following reproducer:

parseInt("");

public static int parseInt(String s) {
if (s == null) {
throw new NumberFormatException("null");
}
boolean isNegative = s.charAt(0) == '-';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.