]> granicus.if.org Git - vim/commitdiff
patch 8.0.1227: undefined left shift in readfile() v8.0.1227
authorBram Moolenaar <Bram@vim.org>
Fri, 27 Oct 2017 20:15:24 +0000 (22:15 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 27 Oct 2017 20:15:24 +0000 (22:15 +0200)
Problem:    Undefined left shift in readfile(). (Brian 'geeknik' Carpenter)
Solution:   Add cast to unsigned. (Dominique Pelle, closes #2253)

src/fileio.c
src/version.c

index 575515613b22700794db49fc807ce033e8d183b5..82659be07b814f21cfc3a33728a7658b90eb0602 100644 (file)
@@ -1956,17 +1956,17 @@ retry:
                    {
                        if (fio_flags & FIO_ENDIAN_L)
                        {
-                           u8c = (*--p << 24);
-                           u8c += (*--p << 16);
-                           u8c += (*--p << 8);
+                           u8c = (unsigned)*--p << 24;
+                           u8c += (unsigned)*--p << 16;
+                           u8c += (unsigned)*--p << 8;
                            u8c += *--p;
                        }
                        else    /* big endian */
                        {
                            u8c = *--p;
-                           u8c += (*--p << 8);
-                           u8c += (*--p << 16);
-                           u8c += (*--p << 24);
+                           u8c += (unsigned)*--p << 8;
+                           u8c += (unsigned)*--p << 16;
+                           u8c += (unsigned)*--p << 24;
                        }
                    }
                    else    /* UTF-8 */
index 71569b34db415faf9b3c4594d4541b48eef33ee7..f66e29255de276adc6e002d24be1ac3bb6f92581 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1227,
 /**/
     1226,
 /**/