]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Always add a suitable error if we fail to decode
authorMatt Caswell <matt@openssl.org>
Mon, 31 Jul 2023 11:30:34 +0000 (12:30 +0100)
committerTomas Mraz <tomas@openssl.org>
Tue, 1 Aug 2023 18:08:28 +0000 (20:08 +0200)
We're always supposed to add the fallback "unsupported" error if we don't
have anything better. However in some cases this wasn't happening because
we were incorrectly setting "flag_construct_called" - even though the
construct function had failed.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21603)

crypto/encode_decode/decoder_lib.c

index d239536175ca919d86091d5d563866a39fb89d07..3718a696ae34461c3468e4bdeffea45913718c41 100644 (file)
@@ -779,10 +779,11 @@ static int decoder_process(const OSSL_PARAM params[], void *arg)
                            (void *)new_data.ctx, LEVEL, rv);
             } OSSL_TRACE_END(DECODER);
 
-            data->flag_construct_called = 1;
             ok = (rv > 0);
-            if (ok)
+            if (ok) {
+                data->flag_construct_called = 1;
                 goto end;
+            }
         }
 
         /* The constructor didn't return success */