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

Uncaught Exception in namehash.ts #1605

Closed
yoshiwarab opened this issue May 25, 2021 · 2 comments
Closed

Uncaught Exception in namehash.ts #1605

yoshiwarab opened this issue May 25, 2021 · 2 comments
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@yoshiwarab
Copy link

Describe the bug
While setting up form field validation for an Ethereum address field I ran into a small bug that throws an uncaught error if provider.resolveName is called with a string ending in a "." character. It looks like the bug is ultimately happening in namehash.ts in the namehash function.

const label = toUtf8Bytes(nameprep(partition[3]));

The attempt to access the third matching group here throws the error because partition is null because the Partition regex will not match a string ending in ".". Not sure if it makes sense to update the regex to ^((.*)\\.)?([^.]*)$ or add a null check for partition or something else.

Thanks so much for the awesome lib!

@yoshiwarab yoshiwarab added the investigate Under investigation and may be a bug. label May 25, 2021
@ricmoo
Copy link
Member

ricmoo commented May 25, 2021

Oh! Thanks! I’ll look into this right away.

@ricmoo ricmoo added on-deck This Enhancement or Bug is currently being worked on. bug Verified to be an issue. and removed investigate Under investigation and may be a bug. labels May 25, 2021
@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Jun 1, 2021
@ricmoo
Copy link
Member

ricmoo commented Jun 1, 2021

Fixed in 5.3.0. Try it out and let me know if you still have any issues.

Thanks! :)

pull bot pushed a commit to shapeshift/ethers.js that referenced this issue Jun 4, 2021
pull bot pushed a commit to shapeshift/ethers.js that referenced this issue Jun 4, 2021
@ricmoo ricmoo closed this as completed Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

2 participants