]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
attribute: Avoid shifting 32 bit integers.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 7 Feb 2016 16:37:00 +0000 (17:37 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 21 Feb 2016 21:44:17 +0000 (22:44 +0100)
att_logical_or() is called from com_check() to set up a bitmask where
a bit is set if and only if it corresponds to an existing attribute.
Doing "1 << i" is wrong in this context because the constant "1" is a
(signed) 32 bit quantity and we need to be able to shift by more than
31 bits for the attribute mask.

Fix this by using an uint64_t variable instead.

attribute.c

index f3f8ea7a45d0fb1136827cc19c8a715fdd3773a6..4cb2982860de78dd26b9fc55ad552c73a7ca1b9f 100644 (file)
@@ -437,13 +437,13 @@ err:
 
 static int att_logical_or(struct osl_row *row, void *data)
 {
-       uint64_t *att_mask = data;
+       uint64_t *att_mask = data, one = 1;
        struct osl_object bitnum_obj;
        int ret = osl_get_object(attribute_table, row, ATTCOL_BITNUM, &bitnum_obj);
 
        if (ret < 0)
                return ret;
-       *att_mask |= 1 << *(unsigned char *)bitnum_obj.data;
+       *att_mask |= one << *(unsigned char *)bitnum_obj.data;
        return 0;
 }