Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
module: ignore module path after null character
Null char as the first char as the path component
of first argument of require causes a node crash.
Ignoring null and all chars after that in require path.

Fixes: #13787
  • Loading branch information
zimbabao committed Jun 19, 2017
commit 0419b14b33ecc88dc479a90074fa0d11487726ba
5 changes: 5 additions & 0 deletions test/parallel/test-require-exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ assert.throws(function() {
require(`${common.fixturesDir}/throws_error`);
}, /^Error: blah$/);

// Requiring the module with null character
assert.throws(function() {
require('../\u0000on');
}, /^Error: blah$/); //TODO: Fix the acual error

// Requiring a module that does not exist should throw an
// error with its `code` set to MODULE_NOT_FOUND
assertModuleNotFound('/DOES_NOT_EXIST');
Expand Down