-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
assert: deepEqual/deepStrictEqual throws on equivalent typed arrays #8001
Labels
assert
Issues and PRs related to the assert subsystem.
Comments
3 tasks
Here's an attempt at a PR to fix the issue: #8002 |
feross
added a commit
to feross/buffer
that referenced
this issue
Aug 8, 2016
Waiting for this issue to be fixed: nodejs/node#8001
cjihrig
pushed a commit
that referenced
this issue
Aug 10, 2016
The typed array's underlying ArrayBuffer is used in `Buffer.from`. Let's respect it's .byteOffset or .byteLength (i.e. position within the parent ArrayBuffer). Fixes: #8001 PR-URL: #8002 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
cjihrig
pushed a commit
to cjihrig/node
that referenced
this issue
Nov 23, 2016
The typed array's underlying ArrayBuffer is used in `Buffer.from`. Let's respect it's .byteOffset or .byteLength (i.e. position within the parent ArrayBuffer). Fixes: nodejs#8001 PR-URL: nodejs#8002 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins
pushed a commit
that referenced
this issue
Dec 13, 2016
The typed array's underlying ArrayBuffer is used in `Buffer.from`. Let's respect it's .byteOffset or .byteLength (i.e. position within the parent ArrayBuffer). Fixes: #8001 PR-URL: #8002 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins
pushed a commit
that referenced
this issue
Dec 21, 2016
The typed array's underlying ArrayBuffer is used in `Buffer.from`. Let's respect it's .byteOffset or .byteLength (i.e. position within the parent ArrayBuffer). Fixes: #8001 PR-URL: #8002 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
itu2n1i8w
added a commit
to itu2n1i8w/buffer
that referenced
this issue
Aug 5, 2024
Waiting for this issue to be fixed: nodejs/node#8001
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code throws an
AssertionError
, when it should not.The error thrown is
AssertionError: Uint8Array [ 2, 3, 4 ] deepEqual Uint8Array [ 2, 3, 4 ]
.This bug is caused by the optimization introduced in step 7.4 of the
_deepEqual
algorithm where typed arrays are converted to Buffers for performance reasons. The error is that the typed array's underlying ArrayBuffer is used without respecting it's.byteOffset
or.byteLength
(i.e. position within the parent ArrayBuffer).When Buffer is used instead of typed arrays, both
assert.deepEqual
andassert.deepStrictEqual
work as expected without throwing an exception.cc @trevnorris @bnoordhuis @jasnell @addaleax
Step 7.1 of the
_deepEqual
algorithm has a special case for objects that areinstanceof Buffer
so this issue hasn't manifested for the Buffer tests in core, even though they're also typed arrays. However, this bug causes issues in the browser buffer test suite, because ourBuffer
class is not consideredinstanceof Buffer
by theassert
package, since it's not a Node Buffer.The text was updated successfully, but these errors were encountered: