# New Ticket Created by  Donald Hunter 
# Please include the string:  [perl #56824]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56824 >


Fixes a segv in the has_exec_protect test on Cygwin.

config/auto/jit/test_exec_cygwin.in

Added #include <string.h> to fix implicit memcpy warning
Changed to memalign(PAGE_SIZE, PAGE_SIZE) because the start and size 
need to be aligned. posix_memalign(...) doesn't exist on cygwin, so 
alignment of size needs to be done manually. Fixes segv in test.

Regards,
Donald Hunter.
Index: config/auto/jit/test_exec_cygwin.in
===================================================================
--- config/auto/jit/test_exec_cygwin.in (revision 29223)
+++ config/auto/jit/test_exec_cygwin.in (working copy)
@@ -5,6 +5,7 @@
 #include <errno.h>
 #include <malloc.h>
 #include <unistd.h>
+#include <string.h>
 #ifndef PAGE_SIZE
 #  define PAGE_SIZE getpagesize()
 #endif
@@ -40,7 +41,7 @@
     if (atoi(argv[1]))
         prot |= PROT_EXEC;
 
-    p = memalign(PAGE_SIZE, sizeof(code));
+    p = memalign(PAGE_SIZE, PAGE_SIZE);
     memcpy(p, code, sizeof(code));
 
     t  = (pf) p;

Reply via email to