Skip to content

<=v4: process.hrtime() segfaults on arrays with error-throwing accessors #7902

Closed
@bengl

Description

@bengl

In latest node v4.x and below, when an array with an accessor that throws is passed into process.hrtime(), it will produce a segmentation fault.

Example

const badArray = []
Object.defineProperty(badArray, 0, {
  get: () => {
    throw Error('I am a bad accessor')
  }
})
process.hrtime(badArray)

On node v5.x and v6.x this will just throw, which is expected. On node v4.x and below, this produces a segmentation fault.

I think this was fixed on v5.x+ by this commit fc143da.

Though this particular case is really edgy, it's my understanding that node APIs probably shouldn't segfault ever.

/cc @mlfbrown @deian who found this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions