changeset 12698:6d3d64be7945 v8.0.1227

patch 8.0.1227: undefined left shift in readfile() commit https://github.com/vim/vim/commit/dc1c98129484e7879bc6dbf38e523beb730988b6 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 27 22:15:24 2017 +0200 patch 8.0.1227: undefined left shift in readfile() Problem: Undefined left shift in readfile(). (Brian 'geeknik' Carpenter) Solution: Add cast to unsigned. (Dominique Pelle, closes https://github.com/vim/vim/issues/2253)
author Christian Brabandt <cb@256bit.org>
date Fri, 27 Oct 2017 22:30:06 +0200
parents 6d76bde47f3e
children fe12aeafe2b3
files src/fileio.c src/version.c
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -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 */
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1227,
+/**/
     1226,
 /**/
     1225,