diff options
author | Mohammed Sadiq <sadiq@sadiqpk.org> | 2017-08-23 20:05:43 +0530 |
---|---|---|
committer | Ernestas Kulik <ernestask@gnome.org> | 2017-08-23 18:50:05 +0300 |
commit | 3ec65acf4bb60ef2f0cf870f3f50e3555a5af371 (patch) | |
tree | d5d4da8883a3d095b5306c7309cc5615f70fc32c | |
parent | b3596e387d839899000908a22678fd26a52250a2 (diff) | |
download | nautilus-3ec65acf4bb60ef2f0cf870f3f50e3555a5af371.tar.gz |
file: use unsigned int when shifting 31 bits
In C, as numbers are signed integers by default, it is an Undefined
Behaviour to left shift a signed integer by 31 bits (when the integer
size is 32 bits which is the common size where nautilus runs).
So explicitly use unsigned integer.
This issue was found by UBsan:
nautilus/src/nautilus-file.c:312:14: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
nautilus/src/nautilus-file.c:4273:11: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
nautilus/src/nautilus-file.c:366:18: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
https://bugzilla.gnome.org/show_bug.cgi?id=786685
-rw-r--r-- | src/nautilus-file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nautilus-file.c b/src/nautilus-file.c index efc54d02b..2d668c1ce 100644 --- a/src/nautilus-file.c +++ b/src/nautilus-file.c @@ -94,7 +94,7 @@ /* Name of Nautilus trash directories */ #define TRASH_DIRECTORY_NAME ".Trash" -#define METADATA_ID_IS_LIST_MASK (1 << 31) +#define METADATA_ID_IS_LIST_MASK (1U << 31) typedef enum { |