-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: detect nul bytes in InternalModuleReadFile()
Throw an exception when the path contains nul bytes, don't abort. Fixes: #13787 PR-URL: #14854 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
- Loading branch information
1 parent
7245082
commit b2112f8
Showing
2 changed files
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
|
||
// Nul bytes should throw, not abort. | ||
assert.throws(() => require('\u0000ab'), /Cannot find module '\u0000ab'/); | ||
assert.throws(() => require('a\u0000b'), /Cannot find module 'a\u0000b'/); | ||
assert.throws(() => require('ab\u0000'), /Cannot find module 'ab\u0000'/); |