Avoid calling sk_*() with NULL #854
Merged
+72
−62
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.
Use explicit NULL checks before interacting with
STACK_OF(*)
.ossl_*_sk2ary()
must no longer be called with NULL.Checks for when
sk_*_num()
returns a negative number are removed. This can only happen when the stack is NULL.This PR also cleans up unreachable code involving NULL stacks:
pkcs7: add a test case for the data content type
While it is not useful alone, it is still a valid content type. Some
methods on OpenSSL::PKCS7 are only meant to work with the signed-data or
enveloped-data. Add some assertions for their behavior with unsupported
content types. The next patches will update the relevant code.
x509: do not check for negative return from X509_*_get_ext_count()
These functions are wrappers of X509v3_get_ext_count(). The
implementation can never return a negative number, and this behavior is
documented in the man page.
x509name: do not check for negative return from X509_NAME_entry_count()
The function never returns a negative number.