Mercurial > hg > nginx-quic
annotate auto/cc/msvc @ 4617:972642646f06
Rewrite: fixed escaping and possible segfault (ticket #162).
The following code resulted in incorrect escaping of uri and possible
segfault:
location / {
rewrite ^(.*) $1?c=$1;
return 200 "$uri";
}
If there were arguments in a rewrite's replacement string, and length was
actually calculated (due to duplicate captures as in the example above,
or variables present), the is_args flag was set and incorrectly copied
after length calculation. This resulted in escaping applied to the uri part
of the replacement, resulting in incorrect escaping. Additionally, buffer
was allocated without escaping expected, thus this also resulted in buffer
overrun and possible segfault.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 11 May 2012 13:19:22 +0000 |
parents | d620f497c50f |
children | 2b71f6535c76 |
rev | line source |
---|---|
455 | 1 |
2 # Copyright (C) Igor Sysoev | |
4412 | 3 # Copyright (C) Nginx, Inc. |
455 | 4 |
5 | |
2630 | 6 # MSVC 6.0 SP2 |
7 # MSVC Toolkit 2003 (7.1) | |
8 # MSVC 2005 Express Edition SP1 (8.0) | |
455 | 9 |
10 # optimizations | |
11 | |
509 | 12 # maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy |
455 | 13 CFLAGS="$CFLAGS -O2" |
509 | 14 |
455 | 15 # enable global optimization |
509 | 16 #CFLAGS="$CFLAGS -Og" |
455 | 17 # enable intrinsic functions |
509 | 18 #CFLAGS="$CFLAGS -Oi" |
19 | |
20 # disable inline expansion | |
21 #CFLAGS="$CFLAGS -Ob0" | |
22 # explicit inline expansion | |
23 #CFLAGS="$CFLAGS -Ob1" | |
24 # explicit and implicit inline expansion | |
25 #CFLAGS="$CFLAGS -Ob2" | |
26 | |
455 | 27 # enable frame pointer omission |
509 | 28 #CFLAGS="$CFLAGS -Oy" |
455 | 29 # disable stack checking calls |
509 | 30 #CFLAGS="$CFLAGS -Gs" |
31 | |
32 # pools strings as read/write | |
33 #CFLAGS="$CFLAGS -Gf" | |
34 # pools strings as read-only | |
35 #CFLAGS="$CFLAGS -GF" | |
36 | |
455 | 37 |
38 case $CPU in | |
39 pentium) | |
40 # optimize for Pentium and Athlon | |
41 CPU_OPT="-G5" | |
42 ;; | |
43 | |
44 pentiumpro) | |
45 # optimize for Pentium Pro, Pentium II and Pentium III | |
46 CPU_OPT="-G6" | |
47 ;; | |
48 | |
49 pentium4) | |
461 | 50 # optimize for Pentium 4, MSVC 7 |
51 CPU_OPT="-G7" | |
455 | 52 ;; |
53 esac | |
54 | |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
2630
diff
changeset
|
55 # __cdecl, default, must be used with OpenSSL, md5 asm, and sha1 asm |
583 | 56 #CPU_OPT="$CPU_OPT -Gd" |
503 | 57 # __stdcall |
58 #CPU_OPT="$CPU_OPT -Gz" | |
59 # __fastcall | |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
2630
diff
changeset
|
60 #CPU_OPT="$CPU_OPT -Gr" |
503 | 61 |
62 | |
455 | 63 CFLAGS="$CFLAGS $CPU_OPT" |
64 | |
65 | |
66 # warnings | |
67 | |
68 CFLAGS="$CFLAGS -W4" | |
69 | |
70 # stop on warning | |
71 CFLAGS="$CFLAGS -WX" | |
72 | |
461 | 73 # disable logo |
74 CFLAGS="$CFLAGS -nologo" | |
75 | |
76 | |
77 LINK="\$(CC)" | |
78 | |
79 # the link flags | |
80 CORE_LINK="$CORE_LINK -link -verbose:lib" | |
81 | |
2630 | 82 # link with libcmt.lib, multithreaded |
83 LIBC="-MT" | |
84 # link with msvcrt.dll | |
85 # however, MSVC Toolkit 2003 has no MSVCRT.LIB | |
86 #LIBC="-MD" | |
455 | 87 |
88 CFLAGS="$CFLAGS $LIBC" | |
89 | |
2725 | 90 CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib" |
91 | |
461 | 92 # Win32 GUI mode application |
2725 | 93 #CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup" |
455 | 94 |
95 # debug | |
2725 | 96 # msvc8 under Wine issues |
97 # Program database manager mismatch; please check your installation | |
1639
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
1638
diff
changeset
|
98 if [ $NGX_CC_NAME != msvc8 ]; then |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
1638
diff
changeset
|
99 CFLAGS="$CFLAGS -Zi" |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
1638
diff
changeset
|
100 CORE_LINK="$CORE_LINK -debug" |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
1638
diff
changeset
|
101 fi |
455 | 102 |
461 | 103 |
2723
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
104 # MSVC 2005 supports C99 variadic macros |
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
105 if [ $NGX_CC_NAME = msvc8 ]; then |
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
106 have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have |
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
107 fi |
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
108 |
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
109 |
455 | 110 # precompiled headers |
1636
f2cf053d14fb
enable precompiled headers for msvc7,
Igor Sysoev <igor@sysoev.ru>
parents:
653
diff
changeset
|
111 CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch" |
f2cf053d14fb
enable precompiled headers for msvc7,
Igor Sysoev <igor@sysoev.ru>
parents:
653
diff
changeset
|
112 NGX_PCH="$NGX_OBJS/ngx_config.pch" |
f2cf053d14fb
enable precompiled headers for msvc7,
Igor Sysoev <igor@sysoev.ru>
parents:
653
diff
changeset
|
113 NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch" |
f2cf053d14fb
enable precompiled headers for msvc7,
Igor Sysoev <igor@sysoev.ru>
parents:
653
diff
changeset
|
114 NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch" |
461 | 115 |
116 | |
117 # the resource file | |
469 | 118 NGX_RES="$NGX_OBJS/nginx.res" |
461 | 119 NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC" |
120 CORE_LINK="$NGX_RES $CORE_LINK" | |
121 | |
455 | 122 |
123 ngx_objout="-Fo" | |
124 ngx_binout="-Fe" | |
125 ngx_objext="obj" | |
126 ngx_binext=".exe" | |
127 | |
2825
bb05c0834c8c
remove BMAKE (build make): a cc compiler should use own make
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
128 ngx_long_start='@<< |
2896 | 129 ' |
2825
bb05c0834c8c
remove BMAKE (build make): a cc compiler should use own make
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
130 ngx_long_end='<<' |
bb05c0834c8c
remove BMAKE (build make): a cc compiler should use own make
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
131 ngx_long_regex_cont=' \ |
633 | 132 ' |
2825
bb05c0834c8c
remove BMAKE (build make): a cc compiler should use own make
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
133 ngx_long_cont=' |
573 | 134 ' |
633 | 135 |
631 | 136 # MSVC understand / in path |
455 | 137 #ngx_regex_dirsep='\\' |
138 #ngx_dirsep="\\" |