﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37418	forms.JSONField crashes with RecursionError on deeply nested input	Philip Sørensen		"`forms.JSONField.to_python()` and `bound_data()` only catch `json.JSONDecodeError`. When the submitted value is nested more deeply than the recursion limit, `json.loads()` raises `RecursionError` instead, so the form crashes (HTTP 500) rather than showing ""Enter a valid JSON."". About 4 KB of input is enough, well within `DATA_UPLOAD_MAX_MEMORY_SIZE`:

{{{
>>> from django import forms
>>> forms.JSONField().clean(""["" * 100_000 + ""]"" * 100_000)
RecursionError: maximum recursion depth exceeded while decoding a JSON array from a unicode string
}}}

This affects any form or ModelForm with a JSONField, including the admin. The `contrib.postgres` `HStoreField` form field has the same pattern.

Patch: also catch `RecursionError` in those three places, with regression tests.
"	Bug	new	Forms	6.1	Normal			Philip Sørensen	Unreviewed	1	0	0	0	0	0
