Skip to content

StringIndexOutOfBoundsException in Java/Maths/ParseInteger.java #1345

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

Closed
pointhi opened this issue Jun 8, 2020 · 1 comment
Closed

StringIndexOutOfBoundsException in Java/Maths/ParseInteger.java #1345

pointhi opened this issue Jun 8, 2020 · 1 comment

Comments

@pointhi
Copy link

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) == '-';

@deadshotsb
Copy link
Member

@yanglbme Kindly mention the pull request for which the issue was closed.

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