Skip to content

Limit JSON reader nesting depth - #4476

Open
vitoriabentes wants to merge 1 commit into
apache:2.xfrom
vitoriabentes:fix/2.x/json-reader-nesting-limit
Open

vitoriabentes wants to merge 1 commit into
apache:2.xfrom
vitoriabentes:fix/2.x/json-reader-nesting-limit

Conversation

@vitoriabentes

Copy link
Copy Markdown
Contributor

Fixes #4463.
Limit JsonReader to 128 levels of nested arrays and objects, throwing IllegalArgumentException when the limit is exceeded. Document that the parser is an internal component intended for trusted Log4j input, add tests for the maximum and excessive nesting depths, and increase the JSON fuzzer's input length now that excessive nesting is bounded.

Testing:

  • .\mvnw.cmd -pl log4j-layout-template-json-test -am '-Dtest=JsonReaderTest' '-Dsurefire.failIfNoSpecifiedTests=false' test — passed (36 tests)

@ramanathan1504 ramanathan1504 added bug Incorrect, unexpected, or unintended behavior of existing code java Pull requests that update Java code layouts Affects one or more Layout plugins port-to-main labels Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Incorrect, unexpected, or unintended behavior of existing code java Pull requests that update Java code layouts Affects one or more Layout plugins port-to-main

Projects

Development

Successfully merging this pull request may close these issues.

Limit the nesting depth of JsonReader and document it as internal

2 participants