Commit 62e2e59
src: fix TLSWrap lifetime bug in ALPN callback
Retrieve the TLSWrap from the SSL object, not SSL_CTX.
A SSL_CTX object is the parent of zero or more SSL objects. TLSWrap is a
wrapper around SSL, SecureContext around SSL_CTX.
Node.js normally uses a SecureContext per TLSWrap but it is possible to
use a SecureContext object more than once.
It was therefore possible for an ALPN callback to use the wrong
(possibly already freed) TLSWrap object.
Having said that, while the bug is clear once you see it, I'm not able
to trigger it (and hence no test, not for lack of trying.)
None of the bug reporters were able to reliably reproduce it either so
the stars probably need to align just right in order to hit it.
Fixes: #47207
PR-URL: #49635
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>1 parent b5d16cd commit 62e2e59
1 file changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
1293 | 1293 | | |
1294 | 1294 | | |
1295 | 1295 | | |
1296 | | - | |
| 1296 | + | |
| 1297 | + | |
1297 | 1298 | | |
1298 | 1299 | | |
1299 | 1300 | | |
| |||
1589 | 1590 | | |
1590 | 1591 | | |
1591 | 1592 | | |
1592 | | - | |
| 1593 | + | |
| 1594 | + | |
1593 | 1595 | | |
1594 | 1596 | | |
1595 | 1597 | | |
| |||
0 commit comments