Mercurial > hg > nginx
annotate auto/cc/msvc @ 9322:d6f75dd66761 default tip
Mp4: added and updated sanity checks for "end" handling.
When handling incorrect data in ngx_http_mp4_crop_stsc_data(),
trak->end_chunk_samples might end up being arbitrary large, leading
to reading before the buffer in ngx_http_mp4_update_stsz_atom(). Fix
is to check that trak->end_chunk_samples corresponds to a memory within
the stsz atom data. For consistency, trak->start_chunk_samples
is checked similarly.
Similarly, trak->end_chunk might end up being smaller than trak->start_chunk,
leading to reading memory after the buffer in ngx_http_mp4_update_stco_atom()
and ngx_http_mp4_update_co64_atom(). Corresponding checks are updated
to explicitly test (trak->end_chunk - trak->start_chunk) instead of just
checking trak->end_chunk and assuming it is larger than trak->start_chunk.
This is generally in line with existing checks of
(trak->end_sample - trak->start_sample) in ngx_http_mp4_update_stsz_atom(),
where trak->end_sample might also become smaller than trak->start_sample
when handling incorrect data in ngx_http_mp4_crop_stts_data().
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 25 Aug 2024 06:35:40 +0300 |
parents | 314be1eba450 |
children |
rev | line source |
---|---|
455 | 1 |
2 # Copyright (C) Igor Sysoev | |
4412 | 3 # Copyright (C) Nginx, Inc. |
455 | 4 |
5 | |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
6 # MSVC 6.0 SP2 cl 12.00 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
7 # MSVC Toolkit 2003 (7.1) cl 13.10 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
8 # MSVC 2005 Express Edition SP1 (8.0) cl 14.00 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
9 # MSVC 2008 Express Edition (9.0) cl 15.00 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
10 # MSVC 2010 (10.0) cl 16.00 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
11 # MSVC 2015 (14.0) cl 19.00 |
9317
314be1eba450
Win32: added modern MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8129
diff
changeset
|
12 # MSVC 2017 (16.9) cl 19.16 |
314be1eba450
Win32: added modern MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8129
diff
changeset
|
13 # MSVC 2022 (17.10.1) cl 19.40 |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
14 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
15 |
8127
17b3efb45b17
Win32: handling of localized MSVC cl output.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7488
diff
changeset
|
16 NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'C/C++.* [0-9][0-9]*\.[0-9]' 2>&1 \ |
17b3efb45b17
Win32: handling of localized MSVC cl output.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7488
diff
changeset
|
17 | sed -e 's/^.* \([0-9][0-9]*\.[0-9].*\)/\1/'` |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
18 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
19 echo " + cl version: $NGX_MSVC_VER" |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
20 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
21 have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/define |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
22 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
23 |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
24 ngx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'` |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
25 |
455 | 26 |
8129
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
27 # detect x64 builds |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
28 |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
29 case "$NGX_MSVC_VER" in |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
30 |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
31 *x64) |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
32 NGX_MACHINE=amd64 |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
33 ;; |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
34 |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
35 *) |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
36 NGX_MACHINE=i386 |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
37 ;; |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
38 |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
39 esac |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
40 |
3c4d81ea1338
Win32: OpenSSL compilation for x64 targets with MSVC.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8127
diff
changeset
|
41 |
455 | 42 # optimizations |
43 | |
509 | 44 # maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy |
455 | 45 CFLAGS="$CFLAGS -O2" |
509 | 46 |
455 | 47 # enable global optimization |
509 | 48 #CFLAGS="$CFLAGS -Og" |
455 | 49 # enable intrinsic functions |
509 | 50 #CFLAGS="$CFLAGS -Oi" |
51 | |
52 # disable inline expansion | |
53 #CFLAGS="$CFLAGS -Ob0" | |
54 # explicit inline expansion | |
55 #CFLAGS="$CFLAGS -Ob1" | |
56 # explicit and implicit inline expansion | |
57 #CFLAGS="$CFLAGS -Ob2" | |
58 | |
455 | 59 # enable frame pointer omission |
509 | 60 #CFLAGS="$CFLAGS -Oy" |
455 | 61 # disable stack checking calls |
509 | 62 #CFLAGS="$CFLAGS -Gs" |
63 | |
64 # pools strings as read/write | |
65 #CFLAGS="$CFLAGS -Gf" | |
66 # pools strings as read-only | |
67 #CFLAGS="$CFLAGS -GF" | |
68 | |
455 | 69 |
70 case $CPU in | |
71 pentium) | |
72 # optimize for Pentium and Athlon | |
73 CPU_OPT="-G5" | |
74 ;; | |
75 | |
76 pentiumpro) | |
77 # optimize for Pentium Pro, Pentium II and Pentium III | |
78 CPU_OPT="-G6" | |
79 ;; | |
80 | |
81 pentium4) | |
461 | 82 # optimize for Pentium 4, MSVC 7 |
83 CPU_OPT="-G7" | |
455 | 84 ;; |
85 esac | |
86 | |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
2630
diff
changeset
|
87 # __cdecl, default, must be used with OpenSSL, md5 asm, and sha1 asm |
583 | 88 #CPU_OPT="$CPU_OPT -Gd" |
503 | 89 # __stdcall |
90 #CPU_OPT="$CPU_OPT -Gz" | |
91 # __fastcall | |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
2630
diff
changeset
|
92 #CPU_OPT="$CPU_OPT -Gr" |
503 | 93 |
94 | |
455 | 95 CFLAGS="$CFLAGS $CPU_OPT" |
96 | |
97 | |
98 # warnings | |
99 | |
100 CFLAGS="$CFLAGS -W4" | |
101 | |
102 # stop on warning | |
103 CFLAGS="$CFLAGS -WX" | |
104 | |
461 | 105 # disable logo |
106 CFLAGS="$CFLAGS -nologo" | |
107 | |
108 # the link flags | |
109 CORE_LINK="$CORE_LINK -link -verbose:lib" | |
110 | |
2630 | 111 # link with libcmt.lib, multithreaded |
112 LIBC="-MT" | |
113 # link with msvcrt.dll | |
114 # however, MSVC Toolkit 2003 has no MSVCRT.LIB | |
115 #LIBC="-MD" | |
455 | 116 |
117 CFLAGS="$CFLAGS $LIBC" | |
118 | |
2725 | 119 CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib" |
120 | |
461 | 121 # Win32 GUI mode application |
2725 | 122 #CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup" |
455 | 123 |
124 # debug | |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
125 # msvc under Wine issues |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
126 # C1902: Program database manager mismatch; please check your installation |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
127 if [ -z "$NGX_WINE" ]; then |
7488
955c4b186354
Win32: defined pdb path.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7031
diff
changeset
|
128 CFLAGS="$CFLAGS -Zi -Fd$NGX_OBJS/nginx.pdb" |
1639
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
1638
diff
changeset
|
129 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
|
130 fi |
455 | 131 |
461 | 132 |
2723
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
133 # MSVC 2005 supports C99 variadic macros |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
134 if [ "$ngx_msvc_ver" -ge 14 ]; then |
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
135 have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have |
2723
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
136 fi |
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
137 |
53be1d485af9
add variadic macros support for msvc8
Igor Sysoev <igor@sysoev.ru>
parents:
2712
diff
changeset
|
138 |
455 | 139 # precompiled headers |
1636
f2cf053d14fb
enable precompiled headers for msvc7,
Igor Sysoev <igor@sysoev.ru>
parents:
653
diff
changeset
|
140 CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch" |
5639
ce98b460606e
Win32: fixed link flags with MSVC, broken by bfe536716dbf.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5577
diff
changeset
|
141 CORE_LINK="$CORE_LINK $NGX_OBJS/ngx_pch.obj" |
1636
f2cf053d14fb
enable precompiled headers for msvc7,
Igor Sysoev <igor@sysoev.ru>
parents:
653
diff
changeset
|
142 NGX_PCH="$NGX_OBJS/ngx_config.pch" |
f2cf053d14fb
enable precompiled headers for msvc7,
Igor Sysoev <igor@sysoev.ru>
parents:
653
diff
changeset
|
143 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
|
144 NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch" |
461 | 145 |
146 | |
147 # the resource file | |
469 | 148 NGX_RES="$NGX_OBJS/nginx.res" |
461 | 149 NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC" |
150 CORE_LINK="$NGX_RES $CORE_LINK" | |
151 | |
455 | 152 |
6383 | 153 # dynamic modules |
154 #MAIN_LINK="-link -def:$NGX_OBJS/nginx.def" | |
155 #MODULE_LINK="-LD $NGX_OBJS/nginx.lib" | |
156 | |
157 | |
158 ngx_pic_opt= | |
455 | 159 ngx_objout="-Fo" |
160 ngx_binout="-Fe" | |
161 ngx_objext="obj" | |
162 | |
2825
bb05c0834c8c
remove BMAKE (build make): a cc compiler should use own make
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
163 ngx_long_start='@<< |
2896 | 164 ' |
2825
bb05c0834c8c
remove BMAKE (build make): a cc compiler should use own make
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
165 ngx_long_end='<<' |
bb05c0834c8c
remove BMAKE (build make): a cc compiler should use own make
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
166 ngx_long_regex_cont=' \ |
633 | 167 ' |
2825
bb05c0834c8c
remove BMAKE (build make): a cc compiler should use own make
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
168 ngx_long_cont=' |
573 | 169 ' |
633 | 170 |
631 | 171 # MSVC understand / in path |
455 | 172 #ngx_regex_dirsep='\\' |
173 #ngx_dirsep="\\" |