-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tls: fix assert in context._external accessor
* Restrict the receiver to instances of the FunctionTemplate. * Use `args.This()` instead of `args.Holder()`. Fixes: #3682 PR-URL: #5521 Reviewed-By: Fedor Indutny <fedor@indutny.com>
- Loading branch information
1 parent
12ae6ab
commit 25c01cd
Showing
2 changed files
with
48 additions
and
21 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,24 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
|
||
if (!common.hasCrypto) { | ||
console.log('1..0 # Skipped: missing crypto'); | ||
return; | ||
} | ||
|
||
// Ensure accessing ._external doesn't hit an assert in the accessor method. | ||
const tls = require('tls'); | ||
{ | ||
const pctx = tls.createSecureContext().context; | ||
const cctx = Object.create(pctx); | ||
assert.throws(() => cctx._external, /incompatible receiver/); | ||
pctx._external; | ||
} | ||
{ | ||
const pctx = tls.createSecurePair().credentials.context; | ||
const cctx = Object.create(pctx); | ||
assert.throws(() => cctx._external, /incompatible receiver/); | ||
pctx._external; | ||
} |