Repository navigation
message: "Assertion `val->IsArrayBufferView()' failed." #41949
Copy link
Copy link
Closed
Labels
string_decoderIssues and PRs related to the string_decoder subsystem.Issues and PRs related to the string_decoder subsystem.
Description
Activity
I'm not sure I understand what the ask here is - to fail with a catchable exception?
Something like:
diff --git a/lib/string_decoder.js b/lib/string_decoder.js index 7447bb3f46..ab6bfb306b 100644 --- a/lib/string_decoder.js +++ b/lib/string_decoder.js @@ -42,6 +42,7 @@ const { } = internalBinding('string_decoder'); const internalUtil = require('internal/util'); const { + ERR_ILLEGAL_CONSTRUCTOR, ERR_INVALID_ARG_TYPE, ERR_UNKNOWN_ENCODING } = require('internal/errors').codes; @@ -101,6 +102,9 @@ StringDecoder.prototype.write = function write(buf) { throw new ERR_INVALID_ARG_TYPE('buf', ['Buffer', 'TypedArray', 'DataView'], buf); + if (!this[kNativeDecoder]) { + throw new ERR_ILLEGAL_CONSTRUCTOR(); + } return decode(this[kNativeDecoder], buf); };
- addedstring_decoderIssues and PRs related to the string_decoder subsystem.Issues and PRs related to the string_decoder subsystem.
on Feb 13, 2022 My intuition is "we shouldn't guard against this sort of thing" most likely. @addaleax wdyt?
I mean, I personally think that it’s fine to add guards (in C++, not JS, to keep performance parity), but I think that ship has sailed for Node.js internals.
Reacted by Benjamin Gruenbaum- added 2 commits that reference this issue
on Feb 20, 2022 Great, I think this issue can be closed.
We can keep this issue open for now and it will get closed automatically when any of the PRs land since I have added
Fixes: <issue-link>to the descriptions. :)OK Thanks!
- added a commit that references this issue
on Mar 8, 2022 - added a commit that references this issue
on Mar 21, 2022 - added 4 commits that reference this issue
on Apr 21, 2022 - added a commit that references this issue
on Apr 25, 2022
Metadata
Metadata
Assignees
Labels
string_decoderIssues and PRs related to the string_decoder subsystem.Issues and PRs related to the string_decoder subsystem.
Version
node-v16.13.2
Platform
Linux astra 4.15.3-141-generic #astra26+ci17 x86_64 GNU/Linux (debian-based)
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Standart buildCompiled with:
gcc (version 8.3.0) ;Configure params:
--prefix="/target/dir";Builded binary info:
node: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped.What is the expected behavior?
No response
What do you see instead?
Stderr with run crafted sample: Abort;
Additional information
Call might be what is causing in type proto (the last dot).