From: Matt Caswell Date: Mon, 31 Jul 2023 11:30:34 +0000 (+0100) Subject: Always add a suitable error if we fail to decode X-Git-Tag: openssl-3.1.3~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc34490fa14f9cb69feb245b9cbbef625cf70c00;p=thirdparty%2Fopenssl.git Always add a suitable error if we fail to decode 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 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/21603) (cherry picked from commit 564e5b754a4680dfad38585dd73bcf025567b448) --- diff --git a/crypto/encode_decode/decoder_lib.c b/crypto/encode_decode/decoder_lib.c index 8863c316d6e..653c1ed6581 100644 --- a/crypto/encode_decode/decoder_lib.c +++ b/crypto/encode_decode/decoder_lib.c @@ -750,10 +750,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 */