-
-
Save bnoordhuis/1d4c6db2fc1dec4e257a to your computer and use it in GitHub Desktop.
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
diff --git a/src/node_crypto.cc b/src/node_crypto.cc | |
index a205404..8e67366 100644 | |
--- a/src/node_crypto.cc | |
+++ b/src/node_crypto.cc | |
@@ -4080,12 +4080,27 @@ void RandomBytesFree(char* data, void* hint) { | |
} | |
+void *xxx; | |
+ | |
template <RandomBytesGenerator generator> | |
void RandomBytesWork(uv_work_t* work_req) { | |
RandomBytesRequest* req = | |
container_of(work_req, RandomBytesRequest, work_req_); | |
- int r = generator(reinterpret_cast<unsigned char*>(req->data_), req->size_); | |
+ struct { | |
+ RandomBytesRequest* req_; | |
+ unsigned char* data_; | |
+ size_t size_; | |
+ } x; | |
+ | |
+ x.req_ = req; | |
+ x.data_ = reinterpret_cast<unsigned char*>(req->data_); | |
+ x.size_ = req->size_; | |
+ | |
+ xxx = (void *) &x; | |
+ | |
+// int r = generator(reinterpret_cast<unsigned char*>(req->data_), req->size_); | |
+ int r = generator(x.data_, x.size_); | |
switch (r) { | |
case 0: | |
@@ -4162,6 +4177,8 @@ Handle<Value> RandomBytes(const Arguments& args) { | |
req->data_ = new char[size]; | |
req->size_ = size; | |
+ assert(req->data_ != NULL); | |
+ | |
if (args[1]->IsFunction()) { | |
Local<Function> callback_v = Local<Function>(Function::Cast(*args[1])); | |
req->callback_ = Persistent<Function>::New(callback_v); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment