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

StackOverflowException caused by function JsValue.ToObject #589

Closed
steffen-liersch opened this issue Jan 22, 2019 · 3 comments · Fixed by #936
Closed

StackOverflowException caused by function JsValue.ToObject #589

steffen-liersch opened this issue Jan 22, 2019 · 3 comments · Fixed by #936
Labels

Comments

@steffen-liersch
Copy link
Contributor

steffen-liersch commented Jan 22, 2019

There is an issue with function JsValue.ToObject. It causes a StackOverflowException for objects with circular references. The issue exists in

  • Jint 2.11.10
  • Jint 3.0.0-beta-1353
  • dev branch

This issue seems to be related with #509.

Here is an example project: https://github.com/steffen-liersch/jint-demos/tree/master/jint-stack-overflow

StackOverflowException occurs when passing "global" to a managed function:

engine.Global.FastAddProperty("global", engine.Global, true, true, true);
engine.Global.FastAddProperty("test", new DelegateWrapper(engine, (Action<object>)Test), true, true, true);
engine.Execute("test(global);");
@windischb
Copy link
Contributor

@sebastienros @lahma
Any chance to get this fixed soon in 3.x?
Are there any other Ideas to prevent my App crashing because of that?

@steffen-liersch
Copy link
Contributor Author

@sebastienros @lahma
Perhaps we need a private overload for ToObject using a helper object that has dictionary containing already handled objects.

@lahma
Copy link
Collaborator

lahma commented Jul 22, 2021

Jint will now throw TypeError when it detects cyclic reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants