Skip to content

Fix a feature Predictable results in nanoid generation when given non-integer values#11719

Closed
kreeksec wants to merge 1 commit into18F:mainfrom
kreeksec:patch-1
Closed

Fix a feature Predictable results in nanoid generation when given non-integer values#11719
kreeksec wants to merge 1 commit into18F:mainfrom
kreeksec:patch-1

Conversation

@kreeksec
Copy link

@kreeksec kreeksec commented Jan 8, 2025

When nanoid is called with a fractional value, there were a number of undesirable effects:

  • in browser and non-secure, the code infinite loops on while (size--)
  • in node, the value of poolOffset becomes fractional, causing calls to nanoid to return zeroes until the pool is next filled
  • if the first call in node is a fractional argument, the initial buffer allocation fails with an error

CVE-2024-55565
CWE-835

@aduth
Copy link
Contributor

aduth commented Jan 8, 2025

Thanks for your pull request! We decided to resolve this a different way in #11722. I have credited you as co-author of the commit in that pull request to acknowledge your contribution.

Thanks again.

@aduth aduth closed this Jan 8, 2025
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

Successfully merging this pull request may close these issues.

3 participants