Skip to content

The Node.js will stuck when exec Object.defineProperty(Array.prototype, '-1', {get: function(){return this[this.length - 1]}}) in REPL #36669

@Me7426

Description

@Me7426

What steps will reproduce the bug?

Object.defineProperty(Array.prototype, '-1', {get: function(){return this[this.length - 1]}})

When exec these code in REPL, the Node.js will let cpu occupancy rate become 100% and stuck itself.

How often does it reproduce? Is there a required condition?

100% reproduce.

What is the expected behavior?

What do you see instead?

> Object.defineProperty(Array.prototype, '-1', {get: function(){return this[this.length - 1]}})
Object(0) []
> 

Additional information

It can be reproduce in Node.js v14.8.0 on my Android's termux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.replIssues and PRs related to the REPL subsystem.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions