You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation Fault When Passing Paths with Japanese Characters to createRequire in Node.js 22+ #56650
constpath=require('path');constModule=require('module')constcreateRequire=Module.createRequire;// あ.js is fail, but ああ.js is successconstresolved=path.resolve('あ.js');console.log(resolved);constreq=createRequire(resolved);// some package...constresult=req.resolve('_');console.log(result);
Run
$ node main.js
How often does it reproduce? Is there a required condition?
It is always reproduced when Node v22 is used under Windows in a Japanese environment.
Segmentation fault does not occur depending on the file name passed.
Not reproduced in Node v20.
What is the expected behavior? Why is that the expected behavior?
No segmentation fault shall occur.
This is expected to be fixed, since tools such as eslint cannot be used if files containing Japanese characters exist, since the same processing as the reproduced code is performed inside eslint.
I have confirmed that the following changes will be processed as intended in the SJIS(cp932) environment.
However, we have not been able to determine the extent of the impact of using locale::global in the node runtime and ignoring the original locale....
Activity
yamachu commentedon Jan 18, 2025
I have confirmed that the following changes will be processed as intended in the SJIS(cp932) environment.
However, we have not been able to determine the extent of the impact of using locale::global in the node runtime and ignoring the original locale....
yamachu@30fc150
yamachu commentedon Jan 19, 2025
node/src/node_modules.cc
Lines 347 to 348 in 009d53e
I followed it in the debugger and it seems to throw an exception when creating this path object.
src: fix to generate path from wchar_t via wstring
test: add test that uses multibyte for path and resolves modules
test: add test that uses multibyte for path and resolves modules
src: fix to generate path from wchar_t via wstring
src: fix to generate path from wchar_t via wstring
test: add test that uses multibyte for path and resolves modules
test: add test that uses multibyte for path and resolves modules
src: fix to generate path from wchar_t via wstring
test: add test that uses multibyte for path and resolves modules
src: fix to generate path from wchar_t via wstring
test: add test that uses multibyte for path and resolves modules
src: fix to generate path from wchar_t via wstring
test: add test that uses multibyte for path and resolves modules
src: fix to generate path from wchar_t via wstring