Ken Takata wrote:

> I confirmed that this happens when both if_perl and if_mzsch are enabled.
> https://ci.appveyor.com/project/k-takata/vim-win32-installer/history
>
> I'm not sure why if_mzsch is related, but now I found that v7.4.1925 causes
> this problem.  The size of time_t is the root cause.
>
> 32-bit versions of ActivePerl and Strawberry Perl require 32-bit time_t.  So
> we define _USE_32BIT_TIME_T in if_perl.xs.  However recent versions of VC are
> 64-bit time_t by default. So the size of time_t is 64 bits in other files.
> The patch 1925 adds a time_t member to xfmark_T which is included in window_T,
> so the size of window_T becomes different in if_perl.xs and in other files.
>
> I confirmed that the following workaround fixes the problem.
> (But there should be much better solution...)
>
> --- a/src/structs.h
> +++ b/src/structs.h
> @@ -114,6 +114,9 @@ typedef struct xfilemark
>      char_u     *fname;         /* file name, used when fnum == 0 */
>  #ifdef FEAT_VIMINFO
>      time_t     time_set;
> +# ifdef _USE_32BIT_TIME_T
> +    int                padding;
> +# endif
>  #endif
>  } xfmark_T;
>
>
> Both test58 and test_perl.vim pass with this patch.
>
> Using 32-bit time_t in all part might be the easiest solution, but I don't
> want to use the solution.  The size of time_t should be 64 bits (except in
> if_perl.xs).
>
>
> Regards,
> Ken Takata

Very nice Ken that you found the reason for this bug!

I think that MPX (Memory Protection eXtension) which is
new in Skylake CPUs can detect this kind of memory corruptions
on Windows or Linux, when compiling with MPX option.
MPX is supported in Visual Studio 2015 or gcc.

I don't have a Skylake CPU. It would be nice if someone who
has Skylake CPU could compile Vim with MPX  (Windows
and/or Linux) to see if MPX finds other memory corruptions
in Vim. Some memory corruptions that MPX can detect
cannot be detected by valgrind or asan (such as this bug
found by Ken Takata).

More info in following links:

[1] describes how to compile with MPX on Windows Visual Studio 2015.
[2] describes MPX with gcc
[3] compares MPX and asan.

[1] 
https://blogs.msdn.microsoft.com/vcblog/2016/01/20/visual-studio-2015-update-1-new-experimental-feature-mpx/
[2] https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler
[3] 
https://github.com/google/sanitizers/wiki/AddressSanitizerIntelMemoryProtectionExtensions

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.

Raspunde prin e-mail lui