]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_11] Type the shifted values to isc_uint32_t so the top bit is unsigned (found...
authorOndřej Surý <ondrej@sury.org>
Thu, 30 Nov 2017 17:27:07 +0000 (18:27 +0100)
committerOndřej Surý <ondrej@sury.org>
Thu, 30 Nov 2017 17:27:07 +0000 (18:27 +0100)
(cherry picked from commit a4a148cf9a44d54feda939eb4cdc6ff30ca74880)

bin/tests/atomic/t_atomic.c
lib/dns/dispatch.c
lib/dns/rbtdb.c
lib/dns/rdata.c
lib/isc/portset.c

index 67ef53354fb11763c548de92768d982070b8f7b4..4f5337dd7f50da1b1ba95a6423498b78a8788164 100644 (file)
@@ -181,7 +181,7 @@ static void
 do_store(isc_task_t *task, isc_event_t *ev) {
        counter_t *state = (counter_t *)ev->ev_arg;
        int i;
-       isc_uint8_t r;
+       isc_uint32_t r;
        isc_uint32_t val;
 
        r = random() % 256;
@@ -205,7 +205,7 @@ test_atomic_store() {
        isc_task_t *tasks[TASKS];
        isc_event_t *event;
        int i;
-       isc_uint8_t r;
+       isc_uint32_t r;
        isc_uint32_t val;
 
        t_assert("test_atomic_store", 1, T_REQUIRED, "%s",
index e5a6889723f84bc6dae092da85e6635cccf2488d..eaddc34d519a5b2f6a28ed2e829db42c28889b4f 100644 (file)
@@ -420,10 +420,10 @@ static isc_uint32_t
 dns_hash(dns_qid_t *qid, isc_sockaddr_t *dest, dns_messageid_t id,
         in_port_t port)
 {
-       unsigned int ret;
+       isc_uint32_t ret;
 
        ret = isc_sockaddr_hash(dest, ISC_TRUE);
-       ret ^= (id << 16) | port;
+       ret ^= ((isc_uint32_t)id << 16) | port;
        ret %= qid->qid_nbuckets;
 
        INSIST(ret < qid->qid_nbuckets);
index 88d80df333015e9860c97d62269f95512d315d0d..1f6d248d9ac84e6d68dc915814d470cb8457dd6c 100644 (file)
@@ -307,7 +307,7 @@ typedef isc_uint32_t                    rbtdb_rdatatype_t;
 
 #define RBTDB_RDATATYPE_BASE(type)      ((dns_rdatatype_t)((type) & 0xFFFF))
 #define RBTDB_RDATATYPE_EXT(type)       ((dns_rdatatype_t)((type) >> 16))
-#define RBTDB_RDATATYPE_VALUE(b, e)     ((rbtdb_rdatatype_t)((e) << 16) | (b))
+#define RBTDB_RDATATYPE_VALUE(base, ext)     ((rbtdb_rdatatype_t)(((isc_uint32_t)ext) << 16) | ((isc_uint32_t)base) & 0xffff)
 
 #define RBTDB_RDATATYPE_SIGNSEC \
                RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec)
index 1aa20309bdc8fbf4034e2db2c949b8845d8a4994..ac9a0c436578779bc46e6fdb0bf234499b560a44 100644 (file)
@@ -1792,10 +1792,10 @@ uint32_fromregion(isc_region_t *region) {
        isc_uint32_t value;
 
        REQUIRE(region->length >= 4);
-       value = region->base[0] << 24;
-       value |= region->base[1] << 16;
-       value |= region->base[2] << 8;
-       value |= region->base[3];
+       value = (isc_uint32_t)region->base[0] << 24;
+       value |= (isc_uint32_t)region->base[1] << 16;
+       value |= (isc_uint32_t)region->base[2] << 8;
+       value |= (isc_uint32_t)region->base[3];
        return(value);
 }
 
index 21dfd6d83a90180506252101266a78ac1733ac4f..a5843c1013bcebe7aeebd4c7fec4464f3588d87e 100644 (file)
@@ -32,14 +32,14 @@ struct isc_portset {
 
 static inline isc_boolean_t
 portset_isset(isc_portset_t *portset, in_port_t port) {
-       return (ISC_TF((portset->buf[port >> 5] & (1 << (port & 31))) != 0));
+       return (ISC_TF((portset->buf[port >> 5] & ((isc_uint32_t)1 << (port & 31))) != 0));
 }
 
 static inline void
 portset_add(isc_portset_t *portset, in_port_t port) {
        if (!portset_isset(portset, port)) {
                portset->nports++;
-               portset->buf[port >> 5] |= (1 << (port & 31));
+               portset->buf[port >> 5] |= ((isc_uint32_t)1 << (port & 31));
        }
 }
 
@@ -47,7 +47,7 @@ static inline void
 portset_remove(isc_portset_t *portset, in_port_t port) {
        if (portset_isset(portset, port)) {
                portset->nports--;
-               portset->buf[port >> 5] &= ~(1 << (port & 31));
+               portset->buf[port >> 5] &= ~((isc_uint32_t)1 << (port & 31));
        }
 }