[PATCH 3 of 4] Win32: i386 now assumed when crossbuilding (ticket #2416)

Maxim Dounin mdounin at mdounin.ru
Tue Dec 20 13:30:17 UTC 2022


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1671542876 -10800
#      Tue Dec 20 16:27:56 2022 +0300
# Node ID 6606ed21a7091b060ebec0d082876ddbbbe0ea79
# Parent  43098cb134a87a404b70fcc77ad01ca343cba969
Win32: i386 now assumed when crossbuilding (ticket #2416).

Previously, NGX_MACHINE was not set when crossbuilding, resulting in
NGX_ALIGNMENT=16 being used in 32-bit builds (if not explicitly set to a
correct value).  This in turn might result in memory corruption in
ngx_palloc() (as there are no usable aligned allocator on Windows, and
normal malloc() is used instead, which provides 8 byte alignment on
32-bit platforms).

To fix this, now i386 machine is set when crossbuilding, so nginx won't
assume strict alignment requirements.

diff -r 43098cb134a8 -r 6606ed21a709 auto/configure
--- a/auto/configure	Tue Dec 20 15:57:58 2022 +0300
+++ b/auto/configure	Tue Dec 20 16:27:56 2022 +0300
@@ -44,6 +44,7 @@ if test -z "$NGX_PLATFORM"; then
 else
     echo "building for $NGX_PLATFORM"
     NGX_SYSTEM=$NGX_PLATFORM
+    NGX_MACHINE=i386
 fi
 
 . auto/cc/conf


More information about the nginx-devel mailing list