[nautilus] file: use unsigned int when shifting 31 bits



commit 3ec65acf4bb60ef2f0cf870f3f50e3555a5af371
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Wed Aug 23 20:05:43 2017 +0530

    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

 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 efc54d0..2d668c1 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
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]