Skip to content

buffer.transcode results in an abort #38330

Closed
@zyscoder

Description

@zyscoder

What steps will reproduce the bug?

Setup a node instance,

» node

and run the following javascript code.

buffer = require('buffer');buf = new buffer.SlowBuffer(1);
buffer.transcode(buf,'utf16le','ucs2');

Then the node instance occurs an abort.

How often does it reproduce? Is there a required condition?

This abort can always be triggered following the steps above.

What is the expected behavior?

If any error occurs, an exception or other similar error-reporting stuff should be thrown. There is no reason to abort the whole node process.

What do you see instead?

» node
Welcome to Node.js v16.0.0-pre.
Type ".help" for more information.
> buffer = require('buffer');buf = new buffer.SlowBuffer(1);
<Buffer 00>
> buffer.transcode(buf,'utf16le','ucs2');
/home/zys/Toolchains/node/node[93333]: ../src/node_i18n.cc:365:void node::i18n::Converter::set_subst_chars(const char*): Assertion `U_SUCCESS(status)' failed.
 1: 0x5617f2c5baf4 node::Abort() [/home/zys/Toolchains/node/node]
 2: 0x5617f2c5bb88  [/home/zys/Toolchains/node/node]
 3: 0x5617f2ca5f9c node::i18n::Converter::Converter(char const*, char const*) [/home/zys/Toolchains/node/node]
 4: 0x5617f2ca6386  [/home/zys/Toolchains/node/node]
 5: 0x5617f2ca48be  [/home/zys/Toolchains/node/node]
 6: 0x5617f2eda167 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/home/zys/Toolchains/node/node]
 7: 0x5617f2edaf10  [/home/zys/Toolchains/node/node]
 8: 0x5617f2edb507  [/home/zys/Toolchains/node/node]
 9: 0x5617f2edb79a v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/zys/Toolchains/node/node]
10: 0x5617f3879259  [/home/zys/Toolchains/node/node]
[1]    93333 abort (core dumped)  /home/zys/Toolchains/node/node                                                                                                                                                                                    

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.confirmed-bugIssues with confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions