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

segfault in property.getter/setter/deleter if property subclass has weird __new__ #100942

Closed
Assignees
rhettinger
Labels
3.10only security fixes3.11only security fixes3.12only security fixestype-crashA hard crash of the interpreter, possibly with a core dump
@cfbolz

Description

@cfbolz

CPython crashes if run on the following code:

classpro(property):def__new__(typ,*args,**kwargs):return"abcdef"classA:passp=property.__new__(pro)p.__set_name__(A,1)np=p.getter(lambdaself:1)

The crash happens on the last line. The problem is thefollowing code inproperty_copy:

new=PyObject_CallFunctionObjArgs(type,get,set,del,doc,NULL);Py_DECREF(type);if (new==NULL)returnNULL;Py_XSETREF(((propertyobject*)new)->prop_name,Py_XNewRef(pold->prop_name));returnnew;

In the crashing code,new is a string, so casting it topropertyobject and writing toprop_name is wrong.

This is synthetic code, I found the problem while porting some 3.10 features to PyPy and thinking about corner cases.

Linked PRs

Metadata

Metadata

Assignees

Labels

3.10only security fixes3.11only security fixes3.12only security fixestype-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp