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

Assertion failure fromStringIO.__setstate__ #127182

Closed
Assignees
sobolevn
Labels
3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dump
@devdanzin

Description

@devdanzin

Crash report

What happened?

It's possible to abort the interpreter by callingStringIO.__setstate__ with a non-stringinitial_value:

python-c"from io import StringIO; StringIO().__setstate__((None, '', 0, {}))"python:Objects/unicodeobject.c:2542:as_ucs4:Assertion `PyUnicode_Check(string)'failed.Aborted (coredumped)

Interestingly, on a non-debug build passing an int asinitial_value gives an error message saying thatNone should be a valid value:

python-c"from io import StringIO; StringIO().__setstate__((1, '', 0, {}))"Traceback (mostrecentcalllast):File"<string>",line1,in<module>fromioimportStringIO;StringIO().__setstate__((1,'',0, {}))~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^TypeError:initial_valuemustbestrorNone,notint

Found usingfusil by@vstinner.

CPython versions tested on:

3.13, 3.14, CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.14.0a2+ (heads/main:0af4ec3, Nov 20 2024, 21:45:19) [GCC 13.2.0]

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-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