Unverified Commit c3c6cb1c authored by Anna Henningsen's avatar Anna Henningsen Committed by Myles Borins
Browse files

util: use proper circular reference checking

Circular references are conceptually nothing that should be checked
for objects (or Sets or Maps) only, but applies to recursive structures
in general, so move the `seen` checks into a position where it is part
of the recursion itself.

Fixes: https://github.com/nodejs/node/issues/14758
PR-URL: https://github.com/nodejs/node/pull/14790


Reviewed-By: default avatarRefael Ackermann <refack@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarEvan Lucas <evanlucas@me.com>
Reviewed-By: default avatarTimothy Gu <timothygu99@gmail.com>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarTobias Nießen <tniessen@tnie.de>
Reviewed-By: default avatarYuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: default avatarAlexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: default avatarRuben Bridgewater <ruben.bridgewater@fintura.de>
parent dcd7817f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment