cpython/Modules
Shamil e87baa8d24
[3.13] gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851) (#150079)
gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851)

User callbacks invoked during JSON encoding (e.g. the `default` callback or
a custom string encoder) can mutate or clear the dict or sequence being
encoded, invalidating borrowed references to items, keys, and values. Hold
strong references unconditionally while iterating.



(cherry picked from commit 235fa7244a)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-19 20:33:22 -07:00
..
_blake2 [3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134962) 2025-06-01 10:27:02 +02:00
_ctypes [3.13] gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791) (#149867) 2026-05-15 11:32:58 +00:00
_decimal [3.13] gh-143331: Schedule to remove format "N" for Decimal (GH-143372) (#143477) 2026-01-06 14:02:32 +00:00
_hacl gh-99108: Refresh HACL*; update modules accordingly; fix namespacing (GH-117237) 2024-03-26 00:35:26 +00:00
_io [3.13] gh-149983: Fix PyErr_NoMemory call without GIL in winconsoleio.c (GH-149984) (GH-150112) 2026-05-19 23:11:28 +02:00
_multiprocessing [3.13] gh-111178: fix UBSan failures in Modules/_multiprocessing/semaphore.c (GH-129084) (#129100) 2025-01-20 21:05:52 +00:00
_sqlite [3.13] gh-146090: fix memory management of internal sqlite3 callback contexts (GH-146569) (#146596) 2026-03-29 15:14:58 +02:00
_sre [3.13] gh-140979: Fix off-by-one error in the RE code validator (GH-140984) (GH-141000) 2025-11-04 18:16:40 +02:00
_ssl [3.13] gh-137583: Only lock the SSL context, not the SSL socket (GH-137588) (GH-137613) 2025-08-11 22:05:13 -04:00
_testcapi [3.13] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (#145901) (#147437) 2026-03-31 17:06:38 +02:00
_testinternalcapi [3.13] gh-135641: Fix flaky test_capi.test_lock_two_threads test case (gh-135642) (gh-135688) 2025-06-18 18:47:59 +00:00
_testlimitedcapi [3.13] gh-132657: add regression test for PySet_Contains with unhashable type (GH-141411) (#141467) 2025-11-12 21:12:18 +05:30
_xxtestfuzz [3.13] gh-121023: Improve _xxtestfuzz/README.rst (GH-121024) (#124140) 2024-09-23 17:23:54 -07:00
cjkcodecs [3.13] gh-101828: Fix jisx0213 codecs removing null characters (gh-139340) (gh-140112) 2025-10-14 14:48:29 +00:00
clinic [3.13] gh-143698: correctly check scheduler and setpgroup values for os.posix_spawn[p] (GH-143699) (#145074) 2026-02-21 16:05:57 +01:00
expat [3.13] gh-149698: Update bundled expat to 2.8.1 (GH-149699) (#149827) 2026-05-14 15:24:39 +00:00
_abc.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_asynciomodule.c [3.13] gh-146615: Fix format specifiers in extension modules (GH-146617) (GH-146652) (GH-146658) 2026-03-31 10:59:06 +00:00
_bisectmodule.c [3.13] gh-126035: add missing whitespace to *Py_EnterRecursiveCall() messages (GH-126036) (#126058) 2024-10-27 22:19:37 +00:00
_bz2module.c [3.13] gh-148395: Fix a possible UAF in {LZMA,BZ2,_Zlib}Decompressor (GH-148396) (#148479) 2026-04-13 01:35:24 +00:00
_codecsmodule.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_collectionsmodule.c [3.13] gh-145492: Fix defaultdict __repr__ infinite recursion (GH-145659) (GH-145746) 2026-03-12 10:45:43 +01:00
_contextvarsmodule.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_csv.c [3.13] gh-145105: Fix crash in csv.reader with re-entrant iterator (GH-145106) (#148405) 2026-04-11 22:44:45 +00:00
_curses_panel.c [3.13] gh-116946: fully implement GC protocol for _curses_panel.panel (GH-138333) (#138428) 2025-09-06 12:17:57 +02:00
_cursesmodule.c [3.13] gh-137920: Fix semantically relevant typo in curses.window.attron (GH-137940) (GH-138507) 2025-10-07 22:22:18 +02:00
_datetimemodule.c [3.13] gh-52551: Fix encoding issues in strftime() (GH-125193) (GH-125657) 2024-10-17 22:48:34 +03:00
_dbmmodule.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_elementtree.c [3.13] gh-148735: Fix a UAF in Element.findtext() (GH-148738) (#148923) 2026-04-25 10:38:14 +01:00
_functoolsmodule.c [3.13] gh-144475: Fix reference management in partial_repr (GH-145362) (#145882) 2026-03-24 02:30:45 +01:00
_gdbmmodule.c [3.13] gh-140272: Fix memory leak in _gdbm.gdbm.clear() (GH-140274) (GH-140289) 2025-10-18 11:00:10 +00:00
_hashopenssl.c [3.13] gh-145301: Fix double-free in hashlib initialization (GH-145321) (GH-145532) 2026-03-10 14:59:37 +01:00
_heapqmodule.c [3.13] Fix comments for heapq.siftup_max (GH-135359) (#136233) 2025-07-03 10:15:01 +00:00
_interpchannelsmodule.c [3.13] gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (GH-149922) (#149954) 2026-05-17 13:36:32 +00:00
_interpqueuesmodule.c [3.13] gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (GH-149922) (#149954) 2026-05-17 13:36:32 +00:00
_interpreters_common.h [3.13] gh-76785: Expand How Interpreter Channels Handle Interpreter Finalization (gh-121811) 2024-07-15 20:15:47 +00:00
_interpretersmodule.c [3.13] gh-135839: Fix module_traverse and module_clear in subinterp modules (GH-135937) (GH-135943) 2025-08-04 14:34:47 +02:00
_json.c [3.13] gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851) (#150079) 2026-05-19 20:33:22 -07:00
_localemodule.c [3.13] Fix unlikely potential reference leak in _locale._getdefaultlocale (GH-145250) (GH-145303) 2026-03-24 02:18:19 +00:00
_lsprof.c [3.13] gh-132250: Clear error in lsprof callback when method descriptor raises an excep… (GH-132251) (#132281) 2025-04-08 17:19:40 -04:00
_lzmamodule.c [3.13] gh-148395: Fix a possible UAF in {LZMA,BZ2,_Zlib}Decompressor (GH-148396) (#148479) 2026-04-13 01:35:24 +00:00
_math.h gh-101678: refactor the math module to use special functions from c11 (GH-101679) 2023-02-09 00:40:52 -08:00
_opcode.c [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043) 2024-06-26 15:35:19 +02:00
_operator.c [3.13] gh-127065: Make methodcaller thread-safe in free threading build (GH-127109) (GH-127150) 2024-11-22 14:51:40 +00:00
_pickle.c [3.13] gh-146059: Call fast_save_leave() in pickle save_frozenset() (GH-146173) (#146474) 2026-03-27 08:47:53 +00:00
_posixsubprocess.c [3.13] gh-141659: Fix bad file descriptor error in subprocess on AIX (GH-141660) (#141828) 2025-11-21 18:10:01 +00:00
_queuemodule.c [3.13] gh-145376: Fix refleak in queuemodule.c out-of-memory path (GH-145543) (#145621) 2026-03-08 13:32:39 +05:30
_randommodule.c [3.13] Fix a compiler warning in _randommodule.c (GH-141058) (#141064) 2025-11-05 19:08:41 +00:00
_scproxy.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_ssl.c [3.13] gh-146615: Fix format specifiers in extension modules (GH-146617) (GH-146652) (GH-146658) 2026-03-31 10:59:06 +00:00
_ssl.h GH-103092: isolate _ssl (#104725) 2023-05-22 06:14:48 +05:30
_ssl_data_31.h gh-103142: Upgrade binary builds and CI to OpenSSL 1.1.1u (#105174) 2023-06-01 09:42:18 -07:00
_ssl_data_111.h gh-103142: Upgrade binary builds and CI to OpenSSL 1.1.1u (#105174) 2023-06-01 09:42:18 -07:00
_ssl_data_300.h gh-103142: Upgrade binary builds and CI to OpenSSL 1.1.1u (#105174) 2023-06-01 09:42:18 -07:00
_stat.c [3.13] gh-108765: fix comment about macro definitions in _stat.c post GH-108854 (GH-136027) (#136044) 2025-06-27 15:39:18 +00:00
_statisticsmodule.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_struct.c [3.13] gh-148529: Minor improvements of the struct module documentation (GH-148565) (GH-149072) 2026-04-27 20:22:47 +00:00
_suggestions.c [3.13] gh-131936: Strengthen check in _suggestions._generate_suggestions (GH-131945) (#131949) 2025-03-31 17:54:20 +00:00
_sysconfig.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_testbuffer.c gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645) 2024-05-06 18:59:36 +02:00
_testcapi_feature_macros.inc gh-91325: Skip Stable ABI checks with Py_TRACE_REFS special build (GH-92046) 2024-01-29 16:45:31 +01:00
_testcapimodule.c [3.13] gh-146615: Fix format specifiers in test cextensions (GH-146618) (GH-146653) 2026-03-31 08:38:59 +00:00
_testclinic.c [3.13] gh-132753: Argument Clinic: Fix support of c_default for the bool converter (GH-132754) (GH-132766) 2025-04-21 07:10:31 +00:00
_testclinic_limited.c gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645) 2024-05-06 18:59:36 +02:00
_testexternalinspection.c [3.13] gh-130052: Fix search_map_for_section() error handling (GH-132594) (#132598) 2025-04-16 14:21:58 +00:00
_testimportmultiple.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_testinternalcapi.c [3.13] gh-146615: Fix format specifiers in test cextensions (GH-146618) (GH-146653) 2026-03-31 08:38:59 +00:00
_testlimitedcapi.c [3.13] gh-111495: Add PyFile tests (#129449) (#129477) 2025-01-30 20:29:27 +01:00
_testmultiphase.c [3.13] gh-129405: Fix doc for Py_mod_multiple_interpreters default, and add test (GH-129406) (GH-130507) 2025-02-24 16:49:35 +01:00
_testsinglephase.c [3.13] gh-144601: Avoid sharing exception objects raised in a PyInit function across multiple interpreters (GH-144602) (GH-144880) 2026-02-16 16:05:55 +00:00
_threadmodule.c [3.13] gh-137017: Ensure Thread.is_alive() only returns False after the underlying OS thread exits (gh-137315) (gh-138917) 2025-09-15 14:28:05 +01:00
_tkinter.c [3.13] gh-143310: fix crash in Tcl object conversion with concurrent mutations (GH-143321) (#143344) 2026-01-02 10:12:57 +00:00
_tracemalloc.c [3.13] gh-128679: Fix tracemalloc.stop() race conditions (#128897) 2025-01-18 23:39:07 +00:00
_typingmodule.c [3.13] gh-123448: Move _PyNoDefault_Type to the static types array (GH-123449) (#123450) 2024-08-28 18:57:28 -07:00
_uuidmodule.c [3.13] gh-132710: only use stable _uuid.generate_time_safe() to deduce MAC address (GH-132901) (#134704) 2025-08-05 07:56:03 +00:00
_weakref.c [3.13] gh-120974: Make _asyncio._leave_task atomic in the free-threaded build (GH-122139) (#122186) 2024-07-23 17:30:58 +00:00
_winapi.c gh-128217: Validate the normalized_environment variable instead of the similarly named function (GH-128220) 2024-12-24 13:29:56 +00:00
_zoneinfo.c [3.13] gh-145883: Fix two heap-buffer-overflows in _zoneinfo (GH-145885) (#148086) 2026-04-04 17:14:19 +01:00
addrinfo.h gh-95174: WASI: skip missing sockets functions (GH-95179) 2022-07-27 08:19:23 +02:00
arraymodule.c [3.13] gh-148484: Fix memory leak of iterator in array.array constructor (GH-148523) (GH-148679) 2026-04-23 16:00:47 +02:00
atexitmodule.c [3.13] gh-142881: Fix concurrent and reentrant call of atexit.unregister() (GH-142901) (GH-143722) 2026-01-12 10:05:09 +00:00
binascii.c [3.13] gh-148093: Raise binascii.Error from binascii.a2b_uu() on empty input (GH-149077) (GH-149349) 2026-05-04 10:06:25 +00:00
cmathmodule.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
config.c.in gh-104169: Fix test_peg_generator after tokenizer refactoring (#110727) 2023-10-12 09:34:35 +02:00
errnomodule.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
faulthandler.c [3.13] gh-149590: Remove faulthandler_traverse (GH-150023) (#150087) 2026-05-19 15:04:13 +00:00
fcntlmodule.c [3.13] gh-140615: Update docstrings in the fcntl module (GH-140619) (GH-141231) (GH-141232) 2025-11-08 11:50:17 +00:00
gc_weakref.txt Fix links to old SF bugs (#95648) 2022-08-04 18:12:35 +02:00
gcmodule.c [3.13] gh-138659: Typo in the gc module docstring (GH-138660) (#138663) 2025-09-08 14:39:43 +00:00
getaddrinfo.c gh-108767: Replace ctype.h functions with pyctype.h functions (#108772) 2023-09-01 18:36:53 +02:00
getbuildinfo.c gh-106320: Remove private pylifecycle.h functions (#106400) 2023-07-04 09:41:43 +00:00
getnameinfo.c gh-95174: WASI: skip missing sockets functions (GH-95179) 2022-07-27 08:19:23 +02:00
getpath.c [3.13] gh-121103: Put free-threaded libraries in lib/python3.14t (GH-121293) (#121631) 2024-07-11 21:00:28 +00:00
getpath.py [3.13] gh-121103: Put free-threaded libraries in lib/python3.14t (GH-121293) (#121631) 2024-07-11 21:00:28 +00:00
getpath_noop.c bpo-45582: Port getpath[p].c to Python (GH-29041) 2021-12-03 00:08:42 +00:00
grpmodule.c [3.13] gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055) (#127104) 2024-11-26 12:01:50 +01:00
hashlib.h [3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134962) 2025-06-01 10:27:02 +02:00
itertoolsmodule.c [3.13] gh-146613: Fix re-entrant use-after-free in itertools._grouper (GH-147962) (#148011) 2026-04-07 12:24:54 +02:00
ld_so_aix.in
main.c [3.13] gh-145376: Fix various reference leaks (GH-145377) (#148661) 2026-05-12 18:35:27 +00:00
makesetup [3.13] gh-116622: Rename build variable MODULE_LDFLAGS back to LIBPYTHON (GH-122764) (GH-122842) 2024-08-09 14:45:04 -07:00
makexp_aix bpo-42087: Remove support for AIX 5.3 and below (GH-22830) 2020-11-16 16:16:10 +01:00
mathmodule.c [3.13] gh-132876: workaround broken ldexp() on Windows 10 (GH-133135) (#134685) 2025-05-25 22:39:34 -05:00
md5module.c [3.13] gh-145376: Fix crashes in md5module.c (GH-145422) (#145611) 2026-03-06 22:24:20 +00:00
mmapmodule.c [3.13] gh-138204: Forbid expansion of a shared anonymous mmap on Linux (GH-138220) (GH-138387) 2025-09-03 11:33:08 +03:00
overlapped.c [3.13] gh-148808: Add boundary check to asyncio.AbstractEventLoop.sock_recvf… (GH-148809) (#148836) 2026-04-21 21:56:37 +05:30
posixmodule.c [3.13] gh-145335: Fix crash when passing -1 as fd in os.pathconf (GH-145390) (#145432) 2026-03-02 18:32:29 +00:00
posixmodule.h gh-85283: Convert grp extension to the limited C API (#116611) 2024-03-12 00:46:53 +00:00
pwdmodule.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
pyexpat.c [3.13] gh-144984: Fix crash in Expat's ExternalEntityParserCreate error paths (GH-144992) (#146142) 2026-04-07 12:22:22 +02:00
readline.c [3.13] gh-122431: Correct the non-negative error message in readline.append_history_file (GH-143075) (GH-143091) 2025-12-23 04:59:43 +00:00
README
resource.c [3.13] gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338) (GH-137507) 2025-08-07 09:37:02 +00:00
rotatingtree.c [3.13] gh-116181: Remove Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE in rotatingtree.c (GH-121260) (#121307) 2024-07-03 07:59:26 +00:00
rotatingtree.h
selectmodule.c [3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012) 2024-07-19 09:13:08 +00:00
Setup gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791) 2024-04-24 16:18:24 +00:00
Setup.bootstrap.in gh-110721: Remove unused code from suggestions.c after moving PyErr_Display to use the traceback module (#113712) 2024-01-08 15:10:45 +00:00
Setup.stdlib.in [3.13] gh-111495: Add PyFile tests (#129449) (#129477) 2025-01-30 20:29:27 +01:00
sha1module.c [3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134962) 2025-06-01 10:27:02 +02:00
sha2module.c [3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134962) 2025-06-01 10:27:02 +02:00
sha3module.c [3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134962) 2025-06-01 10:27:02 +02:00
signalmodule.c [3.13] gh-137490: Fix signal.sigwaitinfo() on NetBSD (GH-137523) (GH-138936) 2025-09-15 16:43:32 +00:00
socketmodule.c [3.13] gh-144837: Improve documentation for more collection methods (GH-144841) (GH-146484) 2026-03-26 19:52:07 +00:00
socketmodule.h [3.13] gh-132429: Fix support of Bluetooth sockets on NetBSD and DragonFly BSD (GH-132431) (GH-132458) 2025-04-13 01:22:41 +03:00
symtablemodule.c [3.13] gh-139748: fix leaks in AC error paths when using unicode FS-b… (#139792) 2025-10-08 22:21:49 +05:30
syslogmodule.c [3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556) 2025-02-25 22:50:26 +00:00
termios.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
timemodule.c [3.13] gh-130617 : fix time_clockid_converter on DragonFlyBSD (GH-130634) (#130666) 2025-02-28 08:19:45 +00:00
tkappinit.c gh-103538: Remove unused TK_AQUA code (GH-103539) 2023-05-10 18:53:13 +00:00
tkinter.h gh-103532: Remove TKINTER_PROTECT_LOADTK code (GH-103535) 2023-04-14 09:04:16 -05:00
unicodedata.c [3.13] gh-88091: Fix unicodedata.decomposition() for Hangul Syllables (GH-144993) (GH-145190) 2026-02-25 00:27:40 +02:00
unicodedata_db.h gh-96954: Fix make regen-unicodedata in out-of-tree builds (#112118) 2023-11-15 16:42:17 +00:00
unicodename_db.h [3.13] gh-80667: Fix lookup for Tangut ideographs in unicodedata (GH-144789) (GH-144871) (GH-144875) 2026-02-16 15:02:01 +00:00
winreparse.h bpo-31512: Add non-elevated symlink support for Windows (GH-3652) 2019-04-09 11:19:46 -07:00
xxlimited.c [3.13] gh-134160: Use PyModuleDef.m_free in the example module xxlimited (GH-135174) (GH-135214) 2025-06-07 11:03:32 +02:00
xxlimited_35.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
xxmodule.c [3.13] gh-122040: reword Modules/xxmodule.c module-level comment (GH-132201) (#132207) 2025-04-07 08:27:34 +00:00
xxsubtype.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
zlibmodule.c [3.13] gh-148395: Fix a possible UAF in {LZMA,BZ2,_Zlib}Decompressor (GH-148396) (#148479) 2026-04-13 01:35:24 +00:00

Source files for standard library extension modules,
and former extension modules that are now builtin modules.