Skip to content

StreamReadConstraints can use same digits limit like play-json internally uses#1254

Merged
mkurz merged 1 commit intoplayframework:mainfrom
mkurz:StreamReadConstraints-digits
Nov 7, 2025
Merged

StreamReadConstraints can use same digits limit like play-json internally uses#1254
mkurz merged 1 commit intoplayframework:mainfrom
mkurz:StreamReadConstraints-digits

Conversation

@mkurz
Copy link
Member

@mkurz mkurz commented Nov 7, 2025

We can avoid Int.MaxValue here.

In play-json itself we check the input's string length:

if (input.length > jsonConfig.bigDecimalParseConfig.digitsLimit) {
JsError("error.expected.numberdigitlimit")

protected def parseBigInteger(input: String): JsResult[java.math.BigInteger] = {
if (input.length > JsonConfig.settings.bigDecimalParseConfig.digitsLimit) {
JsError("error.expected.numberdigitlimit")

In Jackson, it's basically doing the same:

Therefore we can just sync the limit and just use the one supplied by play-json.

@mkurz
Copy link
Member Author

mkurz commented Nov 7, 2025

@pjfanning Can you take a look because you added set the Int.MaxValue? Thanks!

@pjfanning
Copy link
Contributor

The reason I set the max value is that the exception and message are different if Jackson throws it. I guess that this can be documented and that a minor release like 3.1.0 can allow for behaviour changes like this.

@mkurz mkurz merged commit cad389b into playframework:main Nov 7, 2025
14 checks passed
@mkurz mkurz deleted the StreamReadConstraints-digits branch November 7, 2025 13:34
mkurz added a commit to pjfanning/playframework that referenced this pull request Nov 8, 2025
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.

2 participants