-
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.
inspector: prevent integer overflow in open()
PR-URL: #44367 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
- Loading branch information
Showing
3 changed files
with
27 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
17 changes: 17 additions & 0 deletions
17
test/parallel/test-inspector-open-port-integer-overflow.js
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,17 @@ | ||
'use strict'; | ||
|
||
// Regression test for an integer overflow in inspector.open() when the port | ||
// exceeds the range of an unsigned 16-bit integer. | ||
|
||
const common = require('../common'); | ||
common.skipIfInspectorDisabled(); | ||
common.skipIfWorker(); | ||
|
||
const assert = require('assert'); | ||
const inspector = require('inspector'); | ||
|
||
assert.throws(() => inspector.open(99999), { | ||
name: 'RangeError', | ||
code: 'ERR_OUT_OF_RANGE', | ||
message: 'The value of "port" is out of range. It must be >= 0 && <= 65535. Received 99999' | ||
}); |