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

util: fix infinite recursion during inspection #37079

Closed
wants to merge 2 commits into from

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Jan 26, 2021

doc: fix outdated util inspect documentation and layout example

The documentation and layout example was not up to date with the
latest changes.
util: fix infinite recursion during inspection

A specially crafted object with circular structures behind getters
could cause a infinite recursion. This is now fixed by detecting the
objects as already visited.

Fixes: #37054

@nodejs-github-bot nodejs-github-bot added the util Issues and PRs related to the built-in util module. label Jan 26, 2021
@BridgeAR BridgeAR added the needs-ci PRs that need a full CI run. label Jan 26, 2021
@nodejs-github-bot

This comment has been minimized.

@Lxxyx Lxxyx removed the needs-ci PRs that need a full CI run. label Jan 27, 2021
lib/internal/util/inspect.js Outdated Show resolved Hide resolved
lib/internal/util/inspect.js Outdated Show resolved Hide resolved
doc/api/util.md Outdated Show resolved Hide resolved
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with @aduh95's nits and my question about the doc sample code sorted.

@BridgeAR
Copy link
Member Author

PTAL

A specially crafted object with circular structures behind getters
could cause a infinite recursion. This is now fixed by detecting the
objects as already visited.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
The documentation and layout example was not up to date with the
latest changes.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSLGTM

@antsmartian antsmartian added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 29, 2021
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Apr 30, 2021

@jasnell
Copy link
Member

jasnell commented Apr 30, 2021

Landed in 3c6ff9e...5bfb6f0

@jasnell jasnell closed this Apr 30, 2021
jasnell pushed a commit that referenced this pull request Apr 30, 2021
A specially crafted object with circular structures behind getters
could cause a infinite recursion. This is now fixed by detecting the
objects as already visited.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: #37079
Fixes: #37054
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 30, 2021
The documentation and layout example was not up to date with the
latest changes.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: #37079
Fixes: #37054
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
targos pushed a commit that referenced this pull request May 3, 2021
A specially crafted object with circular structures behind getters
could cause a infinite recursion. This is now fixed by detecting the
objects as already visited.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: #37079
Fixes: #37054
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
targos pushed a commit that referenced this pull request May 3, 2021
The documentation and layout example was not up to date with the
latest changes.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: #37079
Fixes: #37054
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
@targos targos mentioned this pull request May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

specific scenario causes infinite recursion in util.inspect (max stack size exceeded)
10 participants