Hi

Running all Vim tests with ubsan (undefined sanitizer
i.e. when compiling with clang or gcc-4.9.* option
-faddress=undefined), I see this error in test72
using Vim-7.4.442.

undo.c:1022:14: runtime error: left shift of 255 by 24 places cannot be
represented in type 'int'

src/undo.c:

 1011     static int
 1012 undo_read_4c(bi)
 1013     bufinfo_T   *bi;
 1014 {
 1015 #ifdef FEAT_CRYPT
 1016     if (bi->bi_buffer != NULL)
 1017     {
 1018         char_u  buf[4];
 1019         int     n;
 1020
 1021         undo_read(bi, buf, (size_t)4);
!1022         n = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
 1023         return n;
 1024     }
 1025 #endif
 1026     return get4c(bi->bi_fp);
 1027 }

Attached patch fixes it.

Regards
Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r cd7c730a3d42 src/undo.c
--- a/src/undo.c	Tue Sep 09 23:11:50 2014 +0200
+++ b/src/undo.c	Wed Sep 10 06:33:42 2014 +0200
@@ -1019,7 +1019,7 @@
 	int	n;
 
 	undo_read(bi, buf, (size_t)4);
-	n = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
+	n = ((unsigned)buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
 	return n;
     }
 #endif

Raspunde prin e-mail lui