UPSTREAM PR #30914: pkcs7: Fix negative index handling in PKCS7_get_issuer_and_serial#676
Open
loci-dev wants to merge 1 commit into
Open
UPSTREAM PR #30914: pkcs7: Fix negative index handling in PKCS7_get_issuer_and_serial#676loci-dev wants to merge 1 commit into
loci-dev wants to merge 1 commit into
Conversation
Reject negative indices before looking up the recipient info stack entry. This makes negative out-of-range indices match the existing behavior for too-large positive indices and avoids dereferencing a NULL recipient info. Add a regression test for the negative index case. Fixes #30910
|
No meaningful performance changes were detected across 20082 analyzed functions in the following binaries: libcrypto.so, libssl.so, openssl. 💬 Questions? Tag @loci-dev |
421b135 to
770bf14
Compare
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.
Note
Source pull request: openssl/openssl#30914
PKCS7_get_issuer_and_serialchecked only the upper bound of the recipient-info index. A negativeidxcould therefore reachsk_PKCS7_RECIP_INFO_value, returnNULLand then be dereferenced.Reject negative indices explicitly and return
NULL, matching the existing out-of-range behavior for indices greater than or equal to the recipient-info stack size.A regression test is added for
idx == -1, while also checking thatidx == 0still returns the expected issuer-and-serial value.Fixes #30910.
The PR commit applies cleanly to master and all four upstream branches openssl-3.4, openssl-3.5, openssl-3.6 and openssl-4.0.