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

buffer.transcode results in an abort #38330

Closed
zyscoder opened this issue Apr 21, 2021 · 2 comments
Closed

buffer.transcode results in an abort #38330

zyscoder opened this issue Apr 21, 2021 · 2 comments
Labels
buffer Issues and PRs related to the buffer subsystem. confirmed-bug Issues with confirmed bugs.

Comments

@zyscoder
Copy link

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

@Ayase-252 Ayase-252 added buffer Issues and PRs related to the buffer subsystem. confirmed-bug Issues with confirmed bugs. labels Apr 21, 2021
@Ayase-252
Copy link
Member

Reproduciable in v16.0.0

Note that using its replacement Buffer.allocUnsafeSlow() also causes abort, although SlowBuffer is depecated.

➜  ~ node
Welcome to Node.js v16.0.0.
Type ".help" for more information.
> buf = buffer.Buffer.allocUnsafeSlow(1)
<Buffer 00>
> buffer.transcode(buf,'utf16le','ucs2');
node[10405]: ../src/node_i18n.cc:365:void node::i18n::Converter::set_subst_chars(const char *): Assertion `U_SUCCESS(status)' failed.
 1: 0x10566aee5 node::Abort() (.cold.1) [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
 2: 0x104320dc9 node::Abort() [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
 3: 0x104320c31 node::Assert(node::AssertionInfo const&) [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
 4: 0x10435ea99 node::i18n::Converter::Converter(char const*, char const*) [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
 5: 0x104360d68 node::i18n::(anonymous namespace)::Transcode(node::Environment*, char const*, char const*, char const*, unsigned long, UErrorCode*) [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
 6: 0x1043609c1 node::i18n::(anonymous namespace)::Transcode(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
 7: 0x104511ae5 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
 8: 0x1045110b8 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
 9: 0x10451067f v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
10: 0x104d9fa19 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/qingyudeng/.nvm/versions/node/v16.0.0/bin/node]
[1]    10405 abort      node

@jasnell
Copy link
Member

jasnell commented Apr 21, 2021

Got a fix incoming

jasnell added a commit to jasnell/node that referenced this issue Apr 21, 2021
@targos targos closed this as completed in 639fa32 Apr 24, 2021
targos pushed a commit that referenced this issue Apr 29, 2021
Signed-off-by: James M Snell <[email protected]>
Fixes: #38330

PR-URL: #38331
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this issue May 30, 2021
Signed-off-by: James M Snell <[email protected]>
Fixes: #38330

PR-URL: #38331
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this issue Jun 5, 2021
Signed-off-by: James M Snell <[email protected]>
Fixes: #38330

PR-URL: #38331
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this issue Jun 11, 2021
Signed-off-by: James M Snell <[email protected]>
Fixes: #38330

PR-URL: #38331
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. confirmed-bug Issues with confirmed bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants