Skip to content

Commit 0484754

Browse files
authored
Fix #1014: increase max string value length from 5 to 20 million characters (#1020)
1 parent cd8494a commit 0484754

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

release-notes/VERSION-2.x

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ JSON library.
2020
`ch.randelshofer:fastdoubleparser`
2121
(reported by Chris R)
2222
#1003: Add FastDoubleParser section to `NOTICE`
23+
#1014: Increase default max allowed String value length from 5 megs to 20 megs
2324

2425
2.15.0 (23-Apr-2023)
2526

src/main/java/com/fasterxml/jackson/core/StreamReadConstraints.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* <ul>
1515
* <li>Maximum Number value length: default 1000 (see {@link #DEFAULT_MAX_NUM_LEN})
1616
* </li>
17-
* <li>Maximum String value length: default 5_000_000 (see {@link #DEFAULT_MAX_STRING_LEN})
17+
* <li>Maximum String value length: default 20_000_000 (see {@link #DEFAULT_MAX_STRING_LEN})
1818
* </li>
1919
* <li>Maximum Nesting depth: default 1000 (see {@link #DEFAULT_MAX_DEPTH})
2020
* </li>
@@ -38,9 +38,12 @@ public class StreamReadConstraints
3838
public static final int DEFAULT_MAX_NUM_LEN = 1000;
3939

4040
/**
41-
* Default setting for maximum string length: see {@link Builder#maxStringLength(int)} for details.
41+
* Default setting for maximum string length: see {@link Builder#maxStringLength(int)}
42+
* for details.
43+
*<p>
44+
* NOTE: Jackson 2.15.0 initially used a lower setting (5_000_000).
4245
*/
43-
public static final int DEFAULT_MAX_STRING_LEN = 5_000_000;
46+
public static final int DEFAULT_MAX_STRING_LEN = 20_000_000;
4447

4548
/**
4649
* Limit for the maximum magnitude of Scale of {@link java.math.BigDecimal} that can be
@@ -98,13 +101,15 @@ public Builder maxNumberLength(final int maxNumLen) {
98101

99102
/**
100103
* Sets the maximum string length (in chars or bytes, depending on input context).
101-
* The default is 5,000,000. This limit is not exact, the limit is applied when we increase
104+
* The default is 20,000,000. This limit is not exact, the limit is applied when we increase
102105
* internal buffer sizes and an exception will happen at sizes greater than this limit. Some
103106
* text values that are a little bigger than the limit may be treated as valid but no text
104107
* values with sizes less than or equal to this limit will be treated as invalid.
105108
* <p>
106109
* Setting this value to lower than the {@link #maxNumberLength(int)} is not recommended.
107110
* </p>
111+
*<p>
112+
* NOTE: Jackson 2.15.0 initially used a lower setting (5_000_000).
108113
*
109114
* @param maxStringLen the maximum string length (in chars or bytes, depending on input context)
110115
*

0 commit comments

Comments
 (0)