Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
fs: fix flag and mode validation
The `flag` and `mode` options were not being validated correctly. Signed-off-by: James M Snell <jasnell@gmail.com> Fixes: #37430 PR-URL: #37480 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
- Loading branch information
Showing
9 changed files
with
67 additions
and
43 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
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,39 @@ | ||
| 'use strict'; | ||
|
|
||
| // Checks for crash regression: https://github.com/nodejs/node/issues/37430 | ||
|
|
||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const { | ||
| open, | ||
| openSync, | ||
| promises: { | ||
| open: openPromise, | ||
| }, | ||
| } = require('fs'); | ||
|
|
||
| // These should throw, not crash. | ||
|
|
||
| assert.throws(() => open(__filename, 2176057344, common.mustNotCall()), { | ||
| code: 'ERR_OUT_OF_RANGE' | ||
| }); | ||
|
|
||
| assert.throws(() => open(__filename, 0, 2176057344, common.mustNotCall()), { | ||
| code: 'ERR_OUT_OF_RANGE' | ||
| }); | ||
|
|
||
| assert.throws(() => openSync(__filename, 2176057344), { | ||
| code: 'ERR_OUT_OF_RANGE' | ||
| }); | ||
|
|
||
| assert.throws(() => openSync(__filename, 0, 2176057344), { | ||
| code: 'ERR_OUT_OF_RANGE' | ||
| }); | ||
|
|
||
| assert.rejects(openPromise(__filename, 2176057344), { | ||
| code: 'ERR_OUT_OF_RANGE' | ||
| }); | ||
|
|
||
| assert.rejects(openPromise(__filename, 0, 2176057344), { | ||
| code: 'ERR_OUT_OF_RANGE' | ||
| }); |
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
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
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

