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

[Fix] return valid values on multi-byte-wide TypedArray input #23

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

ChALkeR
Copy link
Contributor

@ChALkeR ChALkeR commented Nov 17, 2024

Node.js supports any TypedArray or DataView as input, this lib miscalculated on e.g. Uint16Arrays
This patch fixes that

Uint8Array is checked with typeof in index.js

Support for historic Node.js versions on non-Uint8Array Buffer impls and old https://npmjs.com/buffer versions in environments without proper Uint8Array is kept at best-effort (will work on everything that both it and Node.js worked correctly on but will throw on unsupported values, i.e. wide typed arrays when Buffer is not a subclass of Uint8Array)

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@ljharb ljharb changed the title fix: return valid values on multi-byte-wide TypedArray input [Fix] return valid values on multi-byte-wide TypedArray input Nov 17, 2024
@ljharb ljharb merged commit 8fd1364 into browserify:master Nov 17, 2024
404 checks passed
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.

2 participants