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

Under specific circumstances, it may cause a dead cycle #3020

Closed
549915217 opened this issue Aug 30, 2023 · 4 comments
Closed

Under specific circumstances, it may cause a dead cycle #3020

549915217 opened this issue Aug 30, 2023 · 4 comments
Labels

Comments

@549915217
Copy link

549915217 commented Aug 30, 2023

 while (!hasOwnProperty.call(queue, ++base)) continue

The hasOwnProperty method may be polluted in the current environment, leading to incorrect scoping and causing an infinite loop. It is recommended to use the more reliable syntax Object.prototype.hasOwnProperty.call instead.The file path is src\utils\lruQueue.js

Here is the updated code:

while (!Object.prototype.hasOwnProperty.call(queue, ++base)) continue;

By using Object.prototype.hasOwnProperty.call, we ensure that the hasOwnProperty method is correctly scoped and avoid any potential issues with pollution in the environment.

@549915217
Copy link
Author

Describe the bug
Currently, this problem has been discovered in the Qiankun environment

@josdejong
Copy link
Owner

Thanks for reporting. I've fixed this via df4ac5a (not yet published).

On a side note: the lruQueue function can use some extra unit testing I think: all tests pass when I remove the two occurrences of this line of code:

while (!Object.prototype.hasOwnProperty.call(queue, ++base)) {}

If anyone can help improve the tests please let me know.

@549915217
Copy link
Author

I hope to have a new version updated as soon as possible. Thank you.

@josdejong
Copy link
Owner

The fix is published now in v11.10.1

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

No branches or pull requests

2 participants