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] Invalid buf size or offsets not detected #847

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

[BUG] Invalid buf size or offsets not detected #847

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

Recipe for reproducing

import { stringify, v4 } from 'uuid';

const buf = new Uint8Array(16);
v4({}, buf, -8); // Invalid offset should throw, but doesn't
console.log(buf);  // Uint8Array(16) [... (8 bytes),  0, 0, 0, 0, 0, 0, 0, 0]
stringify(buf); // Throws!

Similarly...

const buf = new Uint8Array(15); // Note: 15 bytes, not 16
v4({}, buf); // Invalid buf size should throw, but doesn't
console.log(buf); // [... 15 bytes ...]
stringify(buf); // Throws!

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