Skip to content

Add sensible defaults to StaxUtils's MAX_ELEMENT_COUNT and MAX_XML_CHARACTERS - #3463

Open
reta wants to merge 1 commit into
apache:mainfrom
reta:limit.stax
Open

Add sensible defaults to StaxUtils's MAX_ELEMENT_COUNT and MAX_XML_CHARACTERS#3463
reta wants to merge 1 commit into
apache:mainfrom
reta:limit.stax

Conversation

@reta

@reta reta commented Sep 13, 2026

Copy link
Copy Markdown
Member

Add sensible defaults to StaxUtils's MAX_ELEMENT_COUNT and MAX_XML_CHARACTERS

@reta
reta requested a review from coheigea September 13, 2026 15:41
getInteger(MIN_TEXT_SEGMENT, 64); // Same default as woodstox
private static final long MAX_ELEMENT_COUNT_VAL =
getLong(MAX_ELEMENT_COUNT, Long.MAX_VALUE);
// The MAX_XML_CHARACTERS should be aligned with MAX_TEXT_LENGTH (maximum contiguous length of any character

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coheigea it is difficult to come up with the right defaults here, but:

  • MAX_TEXT_LENGTH is set to 128Mb, so MAX_XML_CHARACTERS is set to at least 2x of that
  • MAX_ELEMENT_COUNT should be larger than MAX_CHILD_ELEMENTS (it is included), so setting it to be at least 10x of MAX_CHILD_ELEMENTS

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