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

[BUG] Short arrays from options.rng() or options.random result in invalid UUIDs #846

Open
broofa opened this issue Dec 24, 2024 · 0 comments · May be fixed by #845
Open

[BUG] Short arrays from options.rng() or options.random result in invalid UUIDs #846

broofa opened this issue Dec 24, 2024 · 0 comments · May be fixed by #845
Labels

Comments

@broofa
Copy link
Member

broofa commented Dec 24, 2024

Description of the problem

Reporting on behalf of @gaoyia

If options.rng() or options.random evaluates to a too-short array (< 16 bytes), the resulting UUID is invalid.

Recipe for reproducing

import {v4} from 'uuid';
console.log(v4({random: new Uint8Array(15)}));
// -> 00000000-0000-4000-8000-0000000000undefined

Additional information

No response

Environment

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant