Skip to content

Getter on TypedArray.prototype.length invoked unexpectedly after path.join in Node.js #58513

@kevgeoleo

Description

@kevgeoleo

Version

v24.1.0

Platform

Microsoft Windows NT 10.0.26100.0 x64

Subsystem

No response

What steps will reproduce the bug?

Hi,
The bug can be reproduced by running the below code snippet:

const path = require('path');

var TypedArray = Object.getPrototypeOf(Int8Array);
const fullPath = path.join("/etc", "passwd");
console.log('Full Path:', fullPath);
Object.defineProperty(TypedArray.prototype, "length", {
  get: function () {
    console.log("foo")
  }
});

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

No specific condition

What is the expected behavior? Why is that the expected behavior?

Full Path: \etc\passwd

What do you see instead?

Full Path: \etc\passwd
foo

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidIssues and PRs that are invalid.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions