Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

gh-120298: Fix use-after-free inlist_richcompare_impl#120303

Merged
sobolevn merged 3 commits intopython:mainfrom
sobolevn:issue-120298
Jun 11, 2024
Merged

gh-120298: Fix use-after-free inlist_richcompare_impl#120303
sobolevn merged 3 commits intopython:mainfrom
sobolevn:issue-120298

Conversation

@sobolevn
Copy link
Member

@sobolevnsobolevn commentedJun 10, 2024
edited by bedevere-appbot
Loading

This code does the same thing as the code above it:

Py_INCREF(vitem);
Py_INCREF(witem);
intk=PyObject_RichCompareBool(vitem,witem,Py_EQ);
Py_DECREF(vitem);
Py_DECREF(witem);

And looks like it gets the job done. I've added tests for these two corner cases.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What bisect or deque do with this?

What tests were added for the similar case above?

@serhiy-storchaka
Copy link
Member

The corresponding test istest_equal_operator_modifying_operand inLib/test/test_list.py (added in2d5bf56,GH-17734). You can perhaps just add a case there.

@sobolevn
Copy link
MemberAuthor

Yes,@serhiy-storchaka, you are correct. I simplified the reproduction to:

classevil(object):def__lt__(self,other):other.clear()returnNotImplementeda=   [ [evil()]]a[0]<a# crash without this patch

I've updated tests to store this test neartest_equal_operator_modifying_operand. Thanks a lot for the advice!

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@sobolevnsobolevn merged commit141baba intopython:mainJun 11, 2024
@sobolevnsobolevn added needs backport to 3.12only security fixes needs backport to 3.13bugs and security fixes labelsJun 11, 2024
@miss-islington-app
Copy link

Thanks@sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks@sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJun 11, 2024
…nGH-120303)(cherry picked from commit141baba)Co-authored-by: Nikita Sobolev <mail@sobolevn.me>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJun 11, 2024
…nGH-120303)(cherry picked from commit141baba)Co-authored-by: Nikita Sobolev <mail@sobolevn.me>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

GH-120339 is a backport of this pull request to the3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12only security fixes labelJun 11, 2024
@bedevere-app
Copy link

GH-120340 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelJun 11, 2024
sobolevn added a commit that referenced this pull requestJun 11, 2024
…20303) (#120339)gh-120298: Fix use-after-free in `list_richcompare_impl` (GH-120303)(cherry picked from commit141baba)Co-authored-by: Nikita Sobolev <mail@sobolevn.me>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
sobolevn added a commit that referenced this pull requestJun 11, 2024
…20303) (#120340)gh-120298: Fix use-after-free in `list_richcompare_impl` (GH-120303)(cherry picked from commit141baba)Co-authored-by: Nikita Sobolev <mail@sobolevn.me>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
mrahtz pushed a commit to mrahtz/cpython that referenced this pull requestJun 30, 2024
…n#120303)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull requestJul 11, 2024
…n#120303)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
estyxx pushed a commit to estyxx/cpython that referenced this pull requestJul 17, 2024
…n#120303)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

@rhettingerrhettingerAwaiting requested review from rhettinger

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@sobolevn@serhiy-storchaka

[8]ページ先頭

©2009-2026 Movatter.jp