enforce maxStringLength/maxNameLength read constraints in XML parser - #917
Open
Sahana2524 wants to merge 1 commit into
Open
Sahana2524 wants to merge 1 commit into
Sahana2524 wants to merge 1 commit into
Conversation
Member
|
This only occurs after-the-fact, XML parser having decoded element/attribute name, text value. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
maxStringLength/maxNameLengthare ignored when reading XMLThe read path never runs the configured
StreamReadConstraintsover element text, attribute values, or element/attribute/root names, so those two limits have no effect on deserialization even though the write side and the JSON backend honor them. WithmaxStringLength(100)a 5000-char text value or attribute value parses cleanly, and withmaxNameLength(50)a 5000-char element, attribute, or root name parses cleanly.This complements the
maxNestingDepthwork in #891 by covering the content-length limits. The checks live whereXmlTokenStreammaterializes each value:validateStringLengthat the single text accessor (getText(), which every element-text and attribute value passes through) andvalidateNameLengthat the two name-decode points (_decodeElementName/_decodeAttributeName, which every name passes through). The constraints are threaded in fromIOContext. Default limits are unchanged, so normal documents behave exactly as before;maxDocumentLength(#609) is a separate concern and not addressed here.