-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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(node/zlib): accept dataview and buffer in zlib bindings #21756
Conversation
32e9e68
to
a10ccfd
Compare
a10ccfd
to
6c78826
Compare
2666caf
to
65e5bce
Compare
65e5bce
to
b5decb9
Compare
@littledivy please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@JoviDeCroock The following Node compat test is failing:
|
@littledivy Yes I can see that 😅 as mentioned in the description I can't quite tell why or what is failing as the whole failure is very vaguely worded |
ext/node/polyfills/_zlib.mjs
Outdated
if (input.buffer) { | ||
input = new Uint8Array(input.buffer); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (input.buffer) { | |
input = new Uint8Array(input.buffer); | |
} | |
if (input.buffer) { | |
input = new Uint8Array(input.buffer); | |
} |
I'm not sure if this is the reason for test failure but the input view should respect offsets.
input = new Uint8Array(input.buffer, input.byteOffset, input.byteLength)
In the test, the compressed buffer is truncated and passed to decompress(). It expects decompress() to fail.
deno/cli/tests/node_compat/test/parallel/test-zlib-truncated.js
Lines 48 to 51 in 59cfe20
// Sync truncated input test | |
assert.throws(function() { | |
zlib[methods.decompSync](truncated); | |
}, errMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that did the trick ye
Fixes #20516 Follow up to #21747 and #21746 This tackles the last point of #20516 where certain inputs weren't accepted in the other zlib methods This adds the `toU8` conversion of `_brotli` to `_zlib.mjs`, when we create the ZLibBuffer, we'll sanitize the input. I noticed that the async had no handler for `string` input so I added that as well.
fixes #20516
Follow up to #21747 and #21746
This tackles the last point of #20516 where certain inputs weren't accepted in the other zlib methods
This adds the
toU8
conversion of_brotli
to_zlib.mjs
, when we create the ZLibBuffer, we'll sanitize the input. I noticed that the async had no handler forstring
input so I added that as well.Not sure what is going wrong here for the parallel test 😅