Skip to content

fix(core): bound unpackValue container nesting depth - #1026

Open
arimu1 wants to merge 1 commit into
msgpack:mainfrom
arimu1:fix/unpack-value-max-nesting-depth
Open

arimu1 wants to merge 1 commit into
msgpack:mainfrom
arimu1:fix/unpack-value-max-nesting-depth

Conversation

@arimu1

@arimu1 arimu1 commented Sep 12, 2026 •

Copy link
Copy Markdown

Summary

  • Add UnpackerConfig.withMaxNestingDepth(int) (default 512) and enforce the limit in both unpackValue() overloads when recursing into ARRAY/MAP containers.
  • When the limit is exceeded, throw MessageSizeException (a MessagePackException) instead of relying on unbounded JVM recursion.

Fixes #1015

Test plan

  • ./sbt "msgpack-core/testOnly org.msgpack.core.NestingDepthLimitTest"
  • ./sbt "msgpack-core/testOnly org.msgpack.core.MessagePackTest" (UnpackerConfig equals)
  • ./sbt msgpack-core/jcheckStyle
Add configurable maxNestingDepth on UnpackerConfig (default 512) so deeply
nested ARRAY/MAP payloads fail with MessageSizeException instead of
StackOverflowError during unpackValue.

Fixes msgpack#1015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 participant