fix: get_public_key_string() error-path leaks on 3.x#114
Merged
atoomic merged 2 commits intoMar 19, 2026
Conversation
timlegge
requested changes
Mar 17, 2026
Collaborator
|
@Koan-Bot rebase |
Replace CHECK_OPEN_SSL with THROW/goto err for the OSSL_ENCODER_CTX setup in get_public_key_string(). If encoder creation or encoding fails, both the OSSL_ENCODER_CTX and BIO are now properly freed before croaking.
25dc24f to
de4e020
Compare
Contributor
Author
Rebase: fix: get_public_key_string() error-path leaks on 3.xBranch Diff: 1 file changed, 15 insertions(+), 9 deletions(-) Review feedback was analyzed and applied. Actions
CICI passed. Automated by Kōan |
timlegge
approved these changes
Mar 18, 2026
Member
|
@atoomic this one looks fine to me |
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.
What
Replace
CHECK_OPEN_SSLwithTHROW/goto erringet_public_key_string()for the OpenSSL 3.x OSSL_ENCODER path.Why
If
OSSL_ENCODER_CTX_new_for_pkey()partially succeeds but the encoders check fails, or ifOSSL_ENCODER_to_bio()fails,CHECK_OPEN_SSLwould croak immediately — leaking theOSSL_ENCODER_CTXand theBIO.Same fix class as PRs #79, #80, #81, #108:
THROW/goto errensures cleanup before croak.Testing
All 219 core tests pass on macOS with OpenSSL 3.6.1.
🤖 Generated with Claude Code