This repository has been archived by the owner on Oct 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zlib: warn before crash on invalid internals usage
PR-URL: nodejs/node#16657 Refs: nodejs/node#16649 Refs: nodejs/node#14161 Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
- Loading branch information
Showing
2 changed files
with
30 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,20 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const os = require('os'); | ||
const cp = require('child_process'); | ||
|
||
if (process.argv[2] === 'child') { | ||
// This is the heart of the test. | ||
new (process.binding('zlib').Zlib)(0).init(1, 2, 3, 4, 5); | ||
} else { | ||
const child = cp.spawnSync(`${process.execPath}`, [`${__filename}`, 'child']); | ||
|
||
assert.strictEqual(child.stdout.toString(), ''); | ||
assert.ok(child.stderr.includes( | ||
'WARNING: You are likely using a version of node-tar or npm that ' + | ||
'is incompatible with this version of Node.js.' + os.EOL + | ||
'Please use either the version of npm that is bundled with Node.js, or ' + | ||
'a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is ' + | ||
'compatible with Node.js 9 and above.' + os.EOL)); | ||
} |