File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change 1515
1616namespace node {
1717
18+ using v8::ArrayBuffer;
19+ using v8::BackingStore;
1820using v8::FunctionCallbackInfo;
1921using v8::Int32;
2022using v8::Just;
@@ -555,17 +557,21 @@ Maybe<bool> GetRsaKeyDetail(
555557 return Nothing<bool >();
556558 }
557559
558- int len = BN_num_bytes (e);
559- AllocatedBuffer public_exponent = AllocatedBuffer::AllocateManaged (env, len);
560- unsigned char * data =
561- reinterpret_cast <unsigned char *>(public_exponent.data ());
562- CHECK_EQ (BN_bn2binpad (e, data, len), len);
560+ std::unique_ptr<BackingStore> public_exponent;
561+ {
562+ NoArrayBufferZeroFillScope no_zero_fill_scope (env->isolate_data ());
563+ public_exponent =
564+ ArrayBuffer::NewBackingStore (env->isolate (), BN_num_bytes (e));
565+ }
566+ CHECK_EQ (BN_bn2binpad (e,
567+ static_cast <unsigned char *>(public_exponent->Data ()),
568+ public_exponent->ByteLength ()),
569+ static_cast <int >(public_exponent->ByteLength ()));
563570
564571 if (target
565- ->Set (
566- env->context (),
567- env->public_exponent_string (),
568- public_exponent.ToArrayBuffer ())
572+ ->Set (env->context (),
573+ env->public_exponent_string (),
574+ ArrayBuffer::New (env->isolate (), std::move (public_exponent)))
569575 .IsNothing ()) {
570576 return Nothing<bool >();
571577 }
You can’t perform that action at this time.
0 commit comments