You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
leti32={size: 4,indirection: 1,get: functionget(buf,offset){returnbuf['readInt32'+"LE"](offset||0);},set: functionset(buf,offset,val){returnbuf['writeInt32'+"LE"](val,offset||0);}};letPtrI32=refType(i32);vartest_alloc=alloc(PtrI32);vartest_deref=test_alloc.deref()// A segment fault occurs on the line below.test_deref[0];// or console.log(test_deref);
I edited ReadPointer function like as follows.
// binding.cc, Line 322
Value ReadPointer(const CallbackInfo& args) {
Env env = args.Env();
char* ptr = AddressForArgs(args);
if (ptr == nullptr) {
throwError::New(env, "readPointer: Cannot read from nullptr pointer");
}
int64_t size = args[2].ToNumber();
printf("ptr: %p\n", ptr);
char* val = *reinterpret_cast<char**>(ptr);
printf("val: %p\n", val);
returnWrapPointer(env, val, size);
}
Then, executed the node and got the result as follows.
ptr: 0000024B2112E8D0
val: 0000000000000002
I did not believe these results.
So, some tests have been performed.
I edited
ReadPointer
function like as follows.Then, executed the node and got the result as follows.
I did not believe these results.
So, some tests have been performed.
Result:
I think need to patch a part of the
ReadPointer
function.The text was updated successfully, but these errors were encountered: