Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for stackoverflow exceptions https://github.com/tjanczuk/edge/iss… #566

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified lib/native/win32/ia32/4.1.1/edge_coreclr.node
Binary file not shown.
Binary file modified lib/native/win32/ia32/4.1.1/edge_nativeclr.node
Binary file not shown.
Binary file modified lib/native/win32/ia32/5.1.0/edge_coreclr.node
Binary file not shown.
Binary file modified lib/native/win32/ia32/5.1.0/edge_nativeclr.node
Binary file not shown.
Binary file modified lib/native/win32/ia32/6.4.0/edge_coreclr.node
Binary file not shown.
Binary file modified lib/native/win32/ia32/6.4.0/edge_nativeclr.node
Binary file not shown.
Binary file modified lib/native/win32/ia32/7.10.0/edge_coreclr.node
Binary file not shown.
Binary file modified lib/native/win32/ia32/7.10.0/edge_nativeclr.node
Binary file not shown.
Binary file modified lib/native/win32/x64/4.1.1/edge_coreclr.node
Binary file not shown.
Binary file modified lib/native/win32/x64/4.1.1/edge_nativeclr.node
Binary file not shown.
Binary file modified lib/native/win32/x64/5.1.0/edge_coreclr.node
Binary file not shown.
Binary file modified lib/native/win32/x64/5.1.0/edge_nativeclr.node
Binary file not shown.
Binary file modified lib/native/win32/x64/6.4.0/edge_coreclr.node
Binary file not shown.
Binary file modified lib/native/win32/x64/6.4.0/edge_nativeclr.node
Binary file not shown.
Binary file modified lib/native/win32/x64/7.10.0/edge_coreclr.node
Binary file not shown.
Binary file modified lib/native/win32/x64/7.10.0/edge_nativeclr.node
Binary file not shown.
2 changes: 1 addition & 1 deletion src/dotnet/clrfunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ v8::Local<v8::Object> ClrFunc::MarshalCLRObjectToV8(System::Object^ netdata)
v8::Local<v8::Object> result = Nan::New<v8::Object>();
System::Type^ type = netdata->GetType();

if (0 == System::String::Compare(type->FullName, "System.Reflection.RuntimeMethodInfo")) {
if (type->FullName->StartsWith("System.Reflection")) {
// Avoid stack overflow due to self-referencing reflection elements
return scope.Escape(result);
}
Expand Down
10 changes: 8 additions & 2 deletions src/double/Edge.js/dotnetcore/coreclrembedding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,14 @@ public static IntPtr MarshalCLRToV8(object clrObject, out V8Type v8Type)
Marshal.WriteIntPtr(objectData.propertyNames, counter*PointerSize, Marshal.StringToHGlobalAnsi(propertyAccessor.Item1));

V8Type propertyType;

Marshal.WriteIntPtr(objectData.propertyValues, counter*PointerSize, MarshalCLRToV8(propertyAccessor.Item2(clrObject), out propertyType));
if(clrObject.GetType().FullName.StartsWith("System.Reflection"))
{
propertyType = V8Type.String;
Marshal.WriteIntPtr(objectData.propertyValues, counter*PointerSize, Marshal.StringToHGlobalAnsi(string.Empty));
}else
{
Marshal.WriteIntPtr(objectData.propertyValues, counter*PointerSize, MarshalCLRToV8(propertyAccessor.Item2(clrObject), out propertyType));
}
Marshal.WriteInt32(objectData.propertyTypes, counter*sizeof (int), (int) propertyType);
counter++;
}
Expand Down
7 changes: 2 additions & 5 deletions src/mono/clrfunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ v8::Local<v8::Object> ClrFunc::MarshalCLRObjectToV8(MonoObject* netdata, MonoExc

if ((0 == strcmp(mono_class_get_name(klass), "MonoType")
&& 0 == strcmp(mono_class_get_namespace(klass), "System"))
|| 0 == strcmp(mono_class_get_namespace(klass), "System.Reflection"))
|| 0 == strcmp(mono_class_get_namespace(klass), "System.Reflection")
|| strncmp (mono_class_get_namespace(klass) ,"System.Reflection", 17) == 0)
{
// Avoid stack overflow due to self-referencing reflection elements
return scope.Escape(result);
Expand Down Expand Up @@ -437,10 +438,6 @@ v8::Local<v8::Object> ClrFunc::MarshalCLRObjectToV8(MonoObject* netdata, MonoExc
}
}

if (*exc)
{
return scope.Escape(v8::Local<v8::Object>::Cast(ClrFunc::MarshalCLRExceptionToV8(*exc)));
}

return scope.Escape(result);
}
Expand Down