mirror of
https://github.com/python/cpython.git
synced 2026-06-22 17:11:44 +00:00
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
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| __main__.py | ||
| json_lines.jsonl | ||
| test_decode.py | ||
| test_default.py | ||
| test_dump.py | ||
| test_encode_basestring_ascii.py | ||
| test_enum.py | ||
| test_fail.py | ||
| test_float.py | ||
| test_indent.py | ||
| test_pass1.py | ||
| test_pass2.py | ||
| test_pass3.py | ||
| test_recursion.py | ||
| test_scanstring.py | ||
| test_separators.py | ||
| test_speedups.py | ||
| test_tool.py | ||
| test_unicode.py | ||