-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed as not planned
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixestype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
Crash report
What happened?
If the buffer created by io.BytesIO.getbuffer() is a part of a reference loop, the garbage collector can crash. Reproducer:
import gc, io
memio = io.BytesIO(b"1234567890")
buf = memio.getbuffer()
a = [buf]
a.append(a)
del memio, buf
del a
gc.collect()It is because bytesiobuf_clear() clears self->source, but bytesiobuf_releasebuffer() uses it.
bytesiobuf_clear() was added in #101819.
CPython versions tested on:
3.12, CPython main branch
Operating systems tested on:
No response
Output from running 'python -VV' on the command line:
No response
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixestype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump