Skip to content

Add tests that check max nested object/array depth (backport #1226) by @mkurz#1227

Merged
mkurz merged 1 commit intomainfrom
mergify/bp/main/pr-1226
Oct 10, 2025
Merged

Add tests that check max nested object/array depth (backport #1226) by @mkurz#1227
mkurz merged 1 commit intomainfrom
mergify/bp/main/pr-1226

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Oct 10, 2025

This forward ports the tests introduced in

We do not need to forward port the fix itself, because we upgraded Jackson in the main branch and fixed the problem with Jackson's StreamReadConstraints already in #1072.

(Therefore the test in the PR can check for the specific jackson exception and message).

@mkurz mkurz changed the title [main] [2.10.x] Avoid running out of memory when parsing heavily nested arrays or objects (backport #1226) by @mkurz Avoid running out of memory when parsing heavily nested arrays or objects (backport #1226) by @mkurz Oct 10, 2025
…ects (#1226)

Just like Jackson 2.15+ we restrict the maximum allowed number of nested arrays or
objects (or mixed) to 1000. This default can be changed via a sys property.
1000 should be enough for most real world use cases.
Note this is about OutOfMemoryError's, not about StackOverflowError's.
StackOverflowError's are not a problem since we use a @tailrec optimized
method. Therefore this fix is not 100% about CVE-2025-52999 (which in
theory we do not run into) but just an additional precaution.

(cherry picked from commit 9722c66)
@mkurz mkurz force-pushed the mergify/bp/main/pr-1226 branch from 73c0f90 to e1cf287 Compare October 10, 2025 08:49
@mkurz mkurz changed the title Avoid running out of memory when parsing heavily nested arrays or objects (backport #1226) by @mkurz Add tests that check max nested object/array depth (backport #1226) by @mkurz Oct 10, 2025
@mkurz mkurz merged commit 43eb60e into main Oct 10, 2025
14 checks passed
@mkurz mkurz deleted the mergify/bp/main/pr-1226 branch October 10, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant