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

A stack overflow occurs when one console.log's a recursive array #792

Closed
dapper-gh opened this issue Oct 4, 2020 · 2 comments
Closed

A stack overflow occurs when one console.log's a recursive array #792

dapper-gh opened this issue Oct 4, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@dapper-gh
Copy link

dapper-gh commented Oct 4, 2020

Describe the bug
If a recursive array is created (an array that contains itself) and then passed to console.log, a stack overflow occurs.
image

To Reproduce

const arr = [];
arr.push(arr);
console.log(arr);

Expected behavior
Normally, something like [Array(1)] is displayed.
image
This works correctly in both the REPL and WASM demo if console.log is not used. In the WASM demo, this error occurs if console.log is used: RuntimeError: memory access out of bounds. In the REPL/CLI, this error occurs if console.log is used: thread 'main' has overflowed its stack
The console.log spec can be found here.

Build environment (please complete the following information):

  • OS: Windows 10
  • Version: Version 1909 (OS Build 18363.1082)
  • Target triple: x86_64-pc-windows-msvc
  • Rustc version: rustc 1.46.0 (04488afe3 2020-08-24)

Additional context
Spec: https://console.spec.whatwg.org/#logger
MDN: https://developer.mozilla.org/en-US/docs/Web/API/Console/log
Related issue: #545
Related PR: #777

@dapper-gh dapper-gh added the bug Something isn't working label Oct 4, 2020
@RageKnify
Copy link
Member

@dapper-gh , #777 fixed this, right?
I can't reproduce on master

@dapper-gh
Copy link
Author

@RageKnify Yes, this was fixed by #777.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants