From 9ad05cd9dbeceabbd1af45c0429c9bc0473da69d Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 9 Dec 2014 17:44:37 +0100 Subject: [PATCH] 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: https://github.com/iojs/io.js/pull/124 Reviewed-By: Ben Noordhuis --- src/node_crypto.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 06651280bfeb45..eec8b560fa7d6a 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -150,7 +150,9 @@ template int SSLWrap::TLSExtStatusCallback(SSL* s, void* arg); static void crypto_threadid_cb(CRYPTO_THREADID* tid) { - CRYPTO_THREADID_set_numeric(tid, uv_thread_self()); + static_assert(sizeof(uv_thread_t) <= sizeof(void*), + "uv_thread_t does not fit in a pointer"); + CRYPTO_THREADID_set_pointer(tid, reinterpret_cast(uv_thread_self())); }