[openssl] master update

Dr. Paul Dale pauli at openssl.org
Mon Jul 12 23:24:24 UTC 2021


The branch master has been updated
       via  a773e67b89208309032d14bd61cf2c2ed4708420 (commit)
      from  d19dacd55f03cb36974fe69e6649bca16d80ab35 (commit)


- Log -----------------------------------------------------------------
commit a773e67b89208309032d14bd61cf2c2ed4708420
Author: Pauli <pauli at openssl.org>
Date:   Sun Jul 11 20:53:43 2021 +1000

    asn.1: fix Coverity 1487104 Logically dead code
    
    Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/16042)

-----------------------------------------------------------------------

Summary of changes:
 crypto/asn1/tasn_enc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/crypto/asn1/tasn_enc.c b/crypto/asn1/tasn_enc.c
index 06473d3411..3ea18b0280 100644
--- a/crypto/asn1/tasn_enc.c
+++ b/crypto/asn1/tasn_enc.c
@@ -348,11 +348,12 @@ static int asn1_template_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
         /* EXPLICIT tagging */
         /* Find length of tagged item */
         i = ASN1_item_ex_i2d(pval, NULL, ASN1_ITEM_ptr(tt->item), -1, iclass);
-        if (!i)
+        if (i == 0) {
+            if ((tt->flags & ASN1_TFLG_OPTIONAL) == 0) {
+                ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT);
+                return -1;
+            }
             return 0;
-        if (i == 0 && (tt->flags & ASN1_TFLG_OPTIONAL) == 0) {
-            ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT);
-            return -1;
         }
         /* Find length of EXPLICIT tag */
         ret = ASN1_object_size(ndef, i, ttag);


More information about the openssl-commits mailing list