Skip to content

Setting __proto__ on vm context's globalThis causes a crash (regression in v19.9.0) #47798

Closed
@domenic

Description

@domenic

Version

v20.0.0

Platform

Microsoft Windows NT 10.0.22621.0 x64

Subsystem

vm

What steps will reproduce the bug?

const vm = require("vm");
const context = vm.createContext();

const contextGlobalThis = vm.runInContext("this", context);

console.log("before");
contextGlobalThis.__proto__ = null;
console.log("after?");

This will only log "before" in Node v19.9.0 and v20.0.0. It will log both "before" and "after?" in Node v19.8.1.

If you log the exit code after a failed run I get 5.

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

Every time.

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

Setting the proto to null should work.

What do you see instead?

A crash

Additional information

This causes jsdom's test suite to crash as this sort of behavior is part of web platform tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions