From 200b4fd964d51e9e061e3425234c5271db3a89b1 Mon Sep 17 00:00:00 2001 From: Steve Hay Date: Mon, 14 Apr 2014 20:59:44 +0100 Subject: [PATCH] Set Off_t et al correctly for USE_LARGE_FILES builds on Windows The canned config files used to build miniperl.exe (with some updates applied by Makefile / makefile.mk) have the non-USE_LARGE_FILES settings for Off_t, LSEEKSIZE and Off_t_size, resulting in an uninitialized memory read in win32_fseek() in miniperl.exe, which recently started causing exetype.pl to write a 4GB wperl.exe during the build of a 64-bit perl. Change Makefile / makefile.mk to use the correct settings for the build of miniperl.exe. This fixes perl #121471. --- pod/perldelta.pod | 6 ++++++ win32/Makefile | 12 ++++++++++++ win32/makefile.mk | 12 ++++++++++++ 3 files changed, 30 insertions(+) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index f952192..05efcda 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -392,6 +392,12 @@ since the process tree kill feature was implemented on Win32. It has now been corrected to follow the documented behaviour. [L] +When building a 64-bit perl, an uninitialized memory read in B, +used during the build process, could lead to a 4GB B being created. +This has now been fixed. (Note that B itself was unaffected, but +obviously B would have been completely broken.) +[L] + The test harness now has no failures when perl is built on a FAT drive with the Windows OS on an NTFS drive. [L] diff --git a/win32/Makefile b/win32/Makefile index a0a3b4e..20c3d17 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -888,6 +888,9 @@ config.w32 : $(CFGSH_TMPL) @echo.>>$@ @echo #ifndef _config_h_footer_>>$@ @echo #define _config_h_footer_>>$@ + @echo #undef Off_t>>$@ + @echo #undef LSEEKSIZE>>$@ + @echo #undef Off_t_size>>$@ @echo #undef PTRSIZE>>$@ @echo #undef SSize_t>>$@ @echo #undef HAS_ATOLL>>$@ @@ -906,6 +909,15 @@ config.w32 : $(CFGSH_TMPL) @echo #undef UVXf>>$@ @echo #undef USE_64_BIT_INT>>$@ @echo #undef Size_t_size>>$@ +!IF "$(USE_LARGE_FILES)"=="define" + @echo #define Off_t __int64>>$@ + @echo #define LSEEKSIZE ^8>>$@ + @echo #define Off_t_size ^8>>$@ +!ELSE + @echo #define Off_t long>>$@ + @echo #define LSEEKSIZE ^4>>$@ + @echo #define Off_t_size ^4>>$@ +!ENDIF !IF "$(WIN64)"=="define" @echo #define PTRSIZE ^8>>$@ @echo #define SSize_t __int64>>$@ diff --git a/win32/makefile.mk b/win32/makefile.mk index c11a7a9..a28cddf 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -1016,6 +1016,9 @@ config.w32 : $(CFGSH_TMPL) @echo.>>$@ @echo #ifndef _config_h_footer_>>$@ @echo #define _config_h_footer_>>$@ + @echo #undef Off_t>>$@ + @echo #undef LSEEKSIZE>>$@ + @echo #undef Off_t_size>>$@ @echo #undef PTRSIZE>>$@ @echo #undef SSize_t>>$@ @echo #undef HAS_ATOLL>>$@ @@ -1034,6 +1037,15 @@ config.w32 : $(CFGSH_TMPL) @echo #undef UVXf>>$@ @echo #undef USE_64_BIT_INT>>$@ @echo #undef Size_t_size>>$@ +.IF "$(USE_LARGE_FILES)"=="define" + @echo #define Off_t $(INT64)>>$@ + @echo #define LSEEKSIZE ^8>>$@ + @echo #define Off_t_size ^8>>$@ +.ELSE + @echo #define Off_t long>>$@ + @echo #define LSEEKSIZE ^4>>$@ + @echo #define Off_t_size ^4>>$@ +.ENDIF .IF "$(WIN64)"=="define" @echo #define PTRSIZE ^8>>$@ @echo #define SSize_t $(INT64)>>$@ -- 2.7.4