Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature problem: Cyclic __proto__ value #452

Open
Yi2255 opened this issue Oct 14, 2024 · 2 comments
Open

Feature problem: Cyclic __proto__ value #452

Yi2255 opened this issue Oct 14, 2024 · 2 comments

Comments

@Yi2255
Copy link
Contributor

Yi2255 commented Oct 14, 2024

Problem

Code generators that use setPrototype may result in a cyclic assignment of __proto__ value.

Example

const o10 = {
    __proto__: 64,
};
const o11 = {
    __proto__: o10,
};
o10.__proto__ = o11; //TypeError: Cyclic __proto__ value

The problem is more likely to be reproduced with the following generators weighting.

cyclic assignment.txt

@saelo
Copy link
Collaborator

saelo commented Oct 16, 2024

Right, this can happen. I'm not sure how big of an issue this is, but what we could do is create a dedicated SetPrototype IL operation and always use guards for it so that we emit a try-catch in JavaScript.

@Yi2255
Copy link
Contributor Author

Yi2255 commented Oct 18, 2024

I understand your point. Thank you for sharing this idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants