Skip to content

Commit 9ad05cd

Browse files
committed
crypto: store thread id as pointer-sized value
uv_thread_t is a HANDLE (void pointer) on Windows, which means that on 64-bit windows it cannot be stored with CRYPTO_THREADID_set_numeric without potential data loss. PR-URL: #124 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent eac8672 commit 9ad05cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/node_crypto.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ template int SSLWrap<TLSCallbacks>::TLSExtStatusCallback(SSL* s, void* arg);
150150

151151

152152
static void crypto_threadid_cb(CRYPTO_THREADID* tid) {
153-
CRYPTO_THREADID_set_numeric(tid, uv_thread_self());
153+
static_assert(sizeof(uv_thread_t) <= sizeof(void*),
154+
"uv_thread_t does not fit in a pointer");
155+
CRYPTO_THREADID_set_pointer(tid, reinterpret_cast<void*>(uv_thread_self()));
154156
}
155157

156158

0 commit comments

Comments
 (0)