Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Apr 2024 21:28:09 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 689dbdedd8bd - stable/14 - heimdal: asn1: Use unsigned bitfields for named bitsets
Message-ID:  <202404242128.43OLS9Y3086296@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=689dbdedd8bdaa0e6c7149a7a26dc77ba9db886e

commit 689dbdedd8bdaa0e6c7149a7a26dc77ba9db886e
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-04-17 17:49:30 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-04-24 21:27:11 +0000

    heimdal: asn1: Use unsigned bitfields for named bitsets
    
    Import upstream 6747e1628:
    
      asn1: Use unsigned bitfields for named bitsets
    
      Signed 1-bit bitfields are undefined in C.
    
    This should fix the following warnings, which for unknown reasons are
    errors in CI:
    
      /usr/src/crypto/heimdal/lib/hx509/ca.c:1020:22: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
       1020 |         ku.digitalSignature = 1;
            |                             ^ ~
      /usr/src/crypto/heimdal/lib/hx509/ca.c:1021:21: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
       1021 |         ku.keyEncipherment = 1;
            |                            ^ ~
      /usr/src/crypto/heimdal/lib/hx509/ca.c:1028:17: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
       1028 |         ku.keyCertSign = 1;
            |                        ^ ~
      /usr/src/crypto/heimdal/lib/hx509/ca.c:1029:13: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
       1029 |         ku.cRLSign = 1;
            |                    ^ ~
    
    PR:             276960
    Fixes:          1b7487592987
    MFC after:      1 week
    
    (cherry picked from commit 219b6e442308d5353b2af5f0771ce9b887b70754)
---
 crypto/heimdal/lib/asn1/gen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/heimdal/lib/asn1/gen.c b/crypto/heimdal/lib/asn1/gen.c
index 76a893c5ade7..f35d41667a57 100644
--- a/crypto/heimdal/lib/asn1/gen.c
+++ b/crypto/heimdal/lib/asn1/gen.c
@@ -727,10 +727,10 @@ define_type (int level, const char *name, const char *basename, Type *t, int typ
 	    fprintf (headerfile, "int64_t %s;\n", name);
 	} else if (t->range->min >= 0 && t->range->max > UINT_MAX) {
 	    fprintf (headerfile, "uint64_t %s;\n", name);
-	} else if (t->range->min >= INT_MIN && t->range->max <= INT_MAX) {
-	    fprintf (headerfile, "int %s;\n", name);
 	} else if (t->range->min >= 0 && t->range->max <= UINT_MAX) {
 	    fprintf (headerfile, "unsigned int %s;\n", name);
+	} else if (t->range->min >= INT_MIN && t->range->max <= INT_MAX) {
+	    fprintf (headerfile, "int %s;\n", name);
 	} else
 	    errx(1, "%s: unsupported range %" PRId64 " -> %" PRId64 "",
 		 name, t->range->min, t->range->max);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404242128.43OLS9Y3086296>