Repository navigation
🐛 fix(xsd): read length and digit facet limits exactly - #2247
Merged
Merged
Conversation
Length, minLength, maxLength, totalDigits and fractionDigits read their limit through a double and stored it in an int. A limit above 2^53 was rounded, and one beyond the int range wrapped to another number, so a short value could be rejected by a large maxLength or accepted by a large minLength. Each limit is now read as an exact integer when the schema compiles, and a limit past the largest count saturates there. Refs tox-dev#2232.
Merging this PR will not alter performance
Comparing Footnotes
|
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.
The length and digit facets of an XSD simple type read their limit through a double and then stored it in an
int. AmaxLengthortotalDigitsabove 2^53 therefore compared against a rounded limit, and a limit beyond theintrange wrapped to a different number. Once this merges,minLength,maxLength,length,totalDigitsandfractionDigitsapply the limit the schema states, which XML Schema Part 2 requires to be anonNegativeInteger. Fixes #2232.Each limit is now read as an exact integer when the schema compiles, and the length and digit counts of a value are compared as the same integer type. A limit larger than the largest value a count can take is capped at that value, so it still accepts every value it accepted before.
Behavior changes
maxLengthabove 2^53 is now accepted, and a short value that passed aminLengthabove 2^53 is now rejected.3.7. The exponent form1e3now reads as1, where it read as1000before.