Commit e09a74e5d1 for openssl.org
commit e09a74e5d136c4aa87bd936c18b90529d5d33ac2
Author: Tomas Mraz <tomas@openssl.org>
Date: Wed Feb 25 09:08:38 2026 +0100
Indicate EOF on fatal error in file or winstore
If decoders setup fails, this is a fatal error.
We indicate EOF from the store as otherwise the store
users will loop indefinitely.
Fixes #28667
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Mar 2 19:38:43 2026
(Merged from https://github.com/openssl/openssl/pull/30170)
diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c
index 8493bb4426..436c3b43dc 100644
--- a/providers/implementations/storemgmt/file_store.c
+++ b/providers/implementations/storemgmt/file_store.c
@@ -106,6 +106,8 @@ struct file_ctx_st {
/* Expected object type. May be unspecified */
int expected_type;
+ /* Fatal error occurred. We should indicate EOF. */
+ int fatal_error;
};
static void free_file_ctx(struct file_ctx_st *ctx)
@@ -555,8 +557,10 @@ static int file_load_file(struct file_ctx_st *ctx,
/* Setup the decoders (one time shot per session */
- if (!file_setup_decoders(ctx))
+ if (!file_setup_decoders(ctx)) {
+ ctx->fatal_error = 1;
return 0;
+ }
/* Setup for this object */
@@ -754,6 +758,9 @@ static int file_eof(void *loaderctx)
{
struct file_ctx_st *ctx = loaderctx;
+ if (ctx->fatal_error)
+ return 1;
+
switch (ctx->type) {
case IS_DIR:
return ctx->_.dir.end_reached;
diff --git a/providers/implementations/storemgmt/winstore_store.c b/providers/implementations/storemgmt/winstore_store.c
index 32965ba7c6..006c946da1 100644
--- a/providers/implementations/storemgmt/winstore_store.c
+++ b/providers/implementations/storemgmt/winstore_store.c
@@ -267,8 +267,10 @@ static int winstore_load_using(struct winstore_ctx_st *ctx,
const unsigned char *der_ = der;
size_t der_len_ = der_len;
- if (setup_decoder(ctx) == 0)
+ if (setup_decoder(ctx) == 0) {
+ ctx->state = STATE_EOF;
return 0;
+ }
data.object_cb = object_cb;
data.object_cbarg = object_cbarg;