Repository navigation
ts: refactor OpenSSL::Timestamp::Factory#create_timestamp - #1148
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new validation paths use rb_raise, leaving TimestampError#errors nil and OpenSSL errors queued, which can break existing error handlers.
1 open issue
What changed in this PR
Refactors OpenSSL::Timestamp::Factory#create_timestamp to simplify exception handling and native-resource cleanup during timestamp generation.
Changes:
- Consolidates response creation under one
rb_protectcall with centralized cleanup. - Adds error checks for signer-key, certificate-stack, and default-policy setters.
| File | Description |
|---|---|
ext/openssl/ossl_ts.c |
Introduces shared creation state and a protected helper, updates callbacks, and centralizes resource cleanup. |
Review effort: Max
Wrap everything in a big rb_protect() to simplify error handling and cleanup. This also fixes potential issues: - Missing error check of TS_RESP_CTX_set_signer_key() - Missing error check of TS_RESP_CTX_set_certs() - Missing error check of TS_RESP_CTX_set_def_policy() - Memory leak when rb_ary_new_capa() raises an exception
rhenium
force-pushed
the
ky/ts-refactor-tsfac-create-ts
branch
from
November 10, 2026 17:07
411011d to
c5c78d0
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.

Wrap everything in a big rb_protect() to simplify error handling and cleanup. This also fixes potential issues: