[3.14] gh-151295: Fix use-after-free in bytes.join()/bytearray.join()… · python/cpython@4f17349 · GitHub
Skip to content

Commit 4f17349

Browse files
[3.14] gh-151295: Fix use-after-free in bytes.join()/bytearray.join() via re-entrant __buffer__ (GH-151296) (GH-151305)
(cherry picked from commit 84a322a) Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
1 parent bbdd3e5 commit 4f17349

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

‎Lib/test/test_bytes.py‎

Lines changed: 26 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fixed a crash (use-after-free) in :meth:`bytes.join` and
2+
:meth:`bytearray.join` that could occur if an item's
3+
:meth:`~object.__buffer__` concurrently mutates the sequence being joined.
4+
The mutation is now reported as a :exc:`RuntimeError` instead.

‎Objects/stringlib/join.h‎

Lines changed: 5 additions & 0 deletions

0 commit comments

Comments
 (0)