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

NumberFormatException thrown to the caller #78

Closed
luchen01 opened this issue Jan 14, 2021 · 2 comments
Closed

NumberFormatException thrown to the caller #78

luchen01 opened this issue Jan 14, 2021 · 2 comments

Comments

@luchen01
Copy link

Hi team,

I have found that calling zxcvbn.measure(password) throws a NumberFormatException for some passwords because len == 0 after the trailing white spaces are trimmed in WipeableString.java. I have no information about the password value which led to this case. But I have tested with string of empty spaces or passwords like 2020 9015 , neither of them threw the exception.

This is the stacktrace:

java.lang.NumberFormatException
	com.nulabinc.zxcvbn.WipeableString.parseInt(WipeableString.java:214)
	com.nulabinc.zxcvbn.WipeableString.parseInt(WipeableString.java:154)
	com.nulabinc.zxcvbn.matchers.DateMatcher.execute(DateMatcher.java:43)
	com.nulabinc.zxcvbn.matchers.OmnibusMatcher.execute(OmnibusMatcher.java:31)
	com.nulabinc.zxcvbn.Matching.omnimatch(Matching.java:51)
	com.nulabinc.zxcvbn.Zxcvbn.measure(Zxcvbn.java:33)
	com.nulabinc.zxcvbn.Zxcvbn.measure(Zxcvbn.java:15)

One suggestion is to expose Invalid Argument as part of a declared exception or at least document that this exception can be thrown. Or alternatively swallowing the exception may be a better approach here.

Thanks!

@vvatanabe
Copy link
Member

@luchen01
Thanks for the report! I will fix it with an approach that swallows exceptions.

vvatanabe added a commit that referenced this issue Feb 9, 2021
fix NumberFormatException in DateMatcher (#78)
@vvatanabe
Copy link
Member

@luchen01 I fixed and released version 1.3.6

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