Repository navigation
Conversation
Contributor
|
I merged a variation I got after review. Fixed the log message, in particular. Thanks. |
Member
Author
Merci ! |
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.
Asn1Parser.parseLength()'s bounds-check guards (added in commits baee26a) all throwIllegalArgumentExceptionviaasn1Parser.lengthInvalid, but hardcode the reported length to-1in everycase, even when the actual decoded value is known and would be useful for diagnosing the failure.
This was discovered while upgrading tomcatspnegoad from Tomcat 9.0.118 to 9.0.119, where its
OtherNameAsn1Parsertest suite (a thin wrapper aroundAsn1Parserused to decode theSAN:otherNamefield from X.509 client certificates, to extract an MS-UPN for Active Directory authentication) started failing due to the changed exception messages.This PR fixes two issues:
-1.bytes > 4octet-count cap is replaced with aBigInteger-based check on the actual decoded magnitude. Per X.690 §8.1.3.5, a BER/DER length may use up to 126 octets and is always unsigned — the onlyreal constraint here is that this implementation returns an
int, so values exceedingInteger.MAX_VALUEcannot be represented. The old cap rejected some encodings (e.g. a non-minimal 5-octet length for asmall value) that are valid per spec and now parse correctly, while cases that genuinely exceed
Integer.MAX_VALUEget a new, accurately-worded message (asn1Parser.lengthUnsupported) instead of beingmisreported as "invalid."
No behavior change for well-formed, in-range input.