-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-142831: Fix UAF in _json module
#142851
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
base: main
Are you sure you want to change the base?
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add tests?
|
Added tests |
|
I pushed a minor test change to make the test run on both pure python and C encoder. |
|
@kumaraditya303 But the new tests don't reproduce the issue! |
This reverts commit 66c3af1.
I was able to reproduce it but now I can't, not sure if it was a build cache issue or something. Sorry reverted it back. |
| def __init__(self): | ||
| super().__init__(real=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not needed, you can just pass arguments to the BadDict constructor at line 97.
| if c_make_encoder is None: | ||
| self.skipTest("c_make_encoder not available") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would not be better to move the test to test_speedups.py?
| #ifdef Py_GIL_DISABLED | ||
| // gh-119438: in the free-threading build the critical section on items can get suspended | ||
|
|
||
| // GH-142831: The item must be strong-referenced to avoid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to do without such comments. They are trivial and only distract from other code. Each Py_INCREF() has reasons, but we do not write it ot for them.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
Hi @ashm-dev do you have spare time working on this PR? I saw there has been 3 weeks since your last update. If not, I'd love to take over the PR and finish rest of the work. Active exploitation of this bug has already been seen in the popular OSS applications such as coze-studio. Let me know what you think.Thanks! |
|
@superboy-zjc The PR is not abandoned and remains with me. Updates will follow when ready. |
This issue requires urgent reaction. Please do finish it soon, or I can help PR shortly thanks. |
json.encodermapping iteration via re-entrant key encoder #142831