From: Andre Noll Date: Sun, 7 Feb 2016 16:37:00 +0000 (+0100) Subject: attribute: Avoid shifting 32 bit integers. X-Git-Tag: v0.5.6~41^2~3 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=2f524f039db0b9239e32668b21258ef4e60ae01b attribute: Avoid shifting 32 bit integers. 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. --- diff --git a/attribute.c b/attribute.c index f3f8ea7a..4cb29828 100644 --- a/attribute.c +++ b/attribute.c @@ -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; }