Set Off_t et al correctly for USE_LARGE_FILES builds on Windows
authorSteve Hay <steve.m.hay@googlemail.com>
Mon, 14 Apr 2014 19:59:44 +0000 (20:59 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Mon, 14 Apr 2014 22:15:25 +0000 (23:15 +0100)
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
win32/Makefile
win32/makefile.mk

index f952192..05efcda 100644 (file)
@@ -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<perl #121230|https://rt.perl.org/Public/Bug/Display.html?id=121230>]
 
+When building a 64-bit perl, an uninitialized memory read in B<miniperl.exe>,
+used during the build process, could lead to a 4GB B<wperl.exe> being created.
+This has now been fixed.  (Note that B<perl.exe> itself was unaffected, but
+obviously B<wperl.exe> would have been completely broken.)
+[L<perl #121471|https://rt.perl.org/Public/Bug/Display.html?id=121471>]
+
 The test harness now has no failures when perl is built on a FAT drive with the
 Windows OS on an NTFS drive.
 [L<perl #21442|https://rt.perl.org/Public/Bug/Display.html?id=21442>]
index a0a3b4e..20c3d17 100644 (file)
@@ -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>>$@
index c11a7a9..a28cddf 100644 (file)
@@ -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)>>$@