Mercurial > hg > orthanc
comparison OrthancFramework/Resources/ThirdParty/minizip/zip.h @ 5428:8174e45f48d8
Upgraded minizip library to stay away from CVE-2023-45853
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 17 Nov 2023 08:58:40 +0100 |
parents | d25f4c0fa160 |
children |
comparison
equal
deleted
inserted
replaced
5427:111e21b4f8bc | 5428:8174e45f48d8 |
---|---|
86 /* default memLevel */ | 86 /* default memLevel */ |
87 | 87 |
88 /* tm_zip contain date/time info */ | 88 /* tm_zip contain date/time info */ |
89 typedef struct tm_zip_s | 89 typedef struct tm_zip_s |
90 { | 90 { |
91 uInt tm_sec; /* seconds after the minute - [0,59] */ | 91 int tm_sec; /* seconds after the minute - [0,59] */ |
92 uInt tm_min; /* minutes after the hour - [0,59] */ | 92 int tm_min; /* minutes after the hour - [0,59] */ |
93 uInt tm_hour; /* hours since midnight - [0,23] */ | 93 int tm_hour; /* hours since midnight - [0,23] */ |
94 uInt tm_mday; /* day of the month - [1,31] */ | 94 int tm_mday; /* day of the month - [1,31] */ |
95 uInt tm_mon; /* months since January - [0,11] */ | 95 int tm_mon; /* months since January - [0,11] */ |
96 uInt tm_year; /* years - [1980..2044] */ | 96 int tm_year; /* years - [1980..2044] */ |
97 } tm_zip; | 97 } tm_zip; |
98 | 98 |
99 typedef struct | 99 typedef struct |
100 { | 100 { |
101 tm_zip tmz_date; /* date in understandable format */ | 101 tm_zip tmz_date; /* date in understandable format */ |
111 | 111 |
112 #define APPEND_STATUS_CREATE (0) | 112 #define APPEND_STATUS_CREATE (0) |
113 #define APPEND_STATUS_CREATEAFTER (1) | 113 #define APPEND_STATUS_CREATEAFTER (1) |
114 #define APPEND_STATUS_ADDINZIP (2) | 114 #define APPEND_STATUS_ADDINZIP (2) |
115 | 115 |
116 extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); | 116 extern zipFile ZEXPORT zipOpen(const char *pathname, int append); |
117 extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); | 117 extern zipFile ZEXPORT zipOpen64(const void *pathname, int append); |
118 /* | 118 /* |
119 Create a zipfile. | 119 Create a zipfile. |
120 pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on | 120 pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on |
121 an Unix computer "zlib/zlib113.zip". | 121 an Unix computer "zlib/zlib113.zip". |
122 if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip | 122 if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip |
129 of this zip package. | 129 of this zip package. |
130 */ | 130 */ |
131 | 131 |
132 /* Note : there is no delete function into a zipfile. | 132 /* Note : there is no delete function into a zipfile. |
133 If you want delete file into a zipfile, you must open a zipfile, and create another | 133 If you want delete file into a zipfile, you must open a zipfile, and create another |
134 Of couse, you can use RAW reading and writing to copy the file you did not want delte | 134 Of course, you can use RAW reading and writing to copy the file you did not want delete |
135 */ | 135 */ |
136 | 136 |
137 extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, | 137 extern zipFile ZEXPORT zipOpen2(const char *pathname, |
138 int append, | |
139 zipcharpc* globalcomment, | |
140 zlib_filefunc_def* pzlib_filefunc_def); | |
141 | |
142 extern zipFile ZEXPORT zipOpen2_64(const void *pathname, | |
138 int append, | 143 int append, |
139 zipcharpc* globalcomment, | 144 zipcharpc* globalcomment, |
140 zlib_filefunc_def* pzlib_filefunc_def)); | 145 zlib_filefunc64_def* pzlib_filefunc_def); |
141 | 146 |
142 extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, | 147 extern zipFile ZEXPORT zipOpen3(const void *pathname, |
143 int append, | 148 int append, |
144 zipcharpc* globalcomment, | 149 zipcharpc* globalcomment, |
145 zlib_filefunc64_def* pzlib_filefunc_def)); | 150 zlib_filefunc64_32_def* pzlib_filefunc64_32_def); |
146 | 151 |
147 extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, | 152 extern int ZEXPORT zipOpenNewFileInZip(zipFile file, |
148 const char* filename, | 153 const char* filename, |
149 const zip_fileinfo* zipfi, | 154 const zip_fileinfo* zipfi, |
150 const void* extrafield_local, | 155 const void* extrafield_local, |
151 uInt size_extrafield_local, | 156 uInt size_extrafield_local, |
152 const void* extrafield_global, | 157 const void* extrafield_global, |
153 uInt size_extrafield_global, | 158 uInt size_extrafield_global, |
154 const char* comment, | 159 const char* comment, |
155 int method, | 160 int method, |
156 int level)); | 161 int level); |
157 | 162 |
158 extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, | 163 extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, |
159 const char* filename, | 164 const char* filename, |
160 const zip_fileinfo* zipfi, | 165 const zip_fileinfo* zipfi, |
161 const void* extrafield_local, | 166 const void* extrafield_local, |
162 uInt size_extrafield_local, | 167 uInt size_extrafield_local, |
163 const void* extrafield_global, | 168 const void* extrafield_global, |
164 uInt size_extrafield_global, | 169 uInt size_extrafield_global, |
165 const char* comment, | 170 const char* comment, |
166 int method, | 171 int method, |
167 int level, | 172 int level, |
168 int zip64)); | 173 int zip64); |
169 | 174 |
170 /* | 175 /* |
171 Open a file in the ZIP for writing. | 176 Open a file in the ZIP for writing. |
172 filename : the filename in zip (if NULL, '-' without quote will be used | 177 filename : the filename in zip (if NULL, '-' without quote will be used |
173 *zipfi contain supplemental information | 178 *zipfi contain supplemental information |
174 if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local | 179 if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local |
175 contains the extrafield data the the local header | 180 contains the extrafield data for the local header |
176 if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global | 181 if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global |
177 contains the extrafield data the the local header | 182 contains the extrafield data for the global header |
178 if comment != NULL, comment contain the comment string | 183 if comment != NULL, comment contain the comment string |
179 method contain the compression method (0 for store, Z_DEFLATED for deflate) | 184 method contain the compression method (0 for store, Z_DEFLATED for deflate) |
180 level contain the level of compression (can be Z_DEFAULT_COMPRESSION) | 185 level contain the level of compression (can be Z_DEFAULT_COMPRESSION) |
181 zip64 is set to 1 if a zip64 extended information block should be added to the local file header. | 186 zip64 is set to 1 if a zip64 extended information block should be added to the local file header. |
182 this MUST be '1' if the uncompressed size is >= 0xffffffff. | 187 this MUST be '1' if the uncompressed size is >= 0xffffffff. |
183 | 188 |
184 */ | 189 */ |
185 | 190 |
186 | 191 |
187 extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, | 192 extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, |
188 const char* filename, | 193 const char* filename, |
189 const zip_fileinfo* zipfi, | 194 const zip_fileinfo* zipfi, |
190 const void* extrafield_local, | 195 const void* extrafield_local, |
191 uInt size_extrafield_local, | 196 uInt size_extrafield_local, |
192 const void* extrafield_global, | 197 const void* extrafield_global, |
193 uInt size_extrafield_global, | 198 uInt size_extrafield_global, |
194 const char* comment, | 199 const char* comment, |
195 int method, | 200 int method, |
196 int level, | 201 int level, |
197 int raw)); | 202 int raw); |
198 | 203 |
199 | 204 |
200 extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, | 205 extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, |
201 const char* filename, | 206 const char* filename, |
202 const zip_fileinfo* zipfi, | 207 const zip_fileinfo* zipfi, |
203 const void* extrafield_local, | 208 const void* extrafield_local, |
204 uInt size_extrafield_local, | 209 uInt size_extrafield_local, |
205 const void* extrafield_global, | 210 const void* extrafield_global, |
206 uInt size_extrafield_global, | 211 uInt size_extrafield_global, |
207 const char* comment, | 212 const char* comment, |
208 int method, | 213 int method, |
209 int level, | 214 int level, |
210 int raw, | 215 int raw, |
211 int zip64)); | 216 int zip64); |
212 /* | 217 /* |
213 Same than zipOpenNewFileInZip, except if raw=1, we write raw file | 218 Same than zipOpenNewFileInZip, except if raw=1, we write raw file |
214 */ | 219 */ |
215 | 220 |
216 extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, | 221 extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, |
217 const char* filename, | 222 const char* filename, |
218 const zip_fileinfo* zipfi, | 223 const zip_fileinfo* zipfi, |
219 const void* extrafield_local, | 224 const void* extrafield_local, |
220 uInt size_extrafield_local, | 225 uInt size_extrafield_local, |
221 const void* extrafield_global, | 226 const void* extrafield_global, |
222 uInt size_extrafield_global, | 227 uInt size_extrafield_global, |
223 const char* comment, | 228 const char* comment, |
224 int method, | 229 int method, |
225 int level, | 230 int level, |
226 int raw, | 231 int raw, |
227 int windowBits, | 232 int windowBits, |
228 int memLevel, | 233 int memLevel, |
229 int strategy, | 234 int strategy, |
230 const char* password, | 235 const char* password, |
231 uLong crcForCrypting)); | 236 uLong crcForCrypting); |
232 | 237 |
233 extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, | 238 extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, |
234 const char* filename, | 239 const char* filename, |
235 const zip_fileinfo* zipfi, | 240 const zip_fileinfo* zipfi, |
236 const void* extrafield_local, | 241 const void* extrafield_local, |
237 uInt size_extrafield_local, | 242 uInt size_extrafield_local, |
238 const void* extrafield_global, | 243 const void* extrafield_global, |
239 uInt size_extrafield_global, | 244 uInt size_extrafield_global, |
240 const char* comment, | 245 const char* comment, |
241 int method, | 246 int method, |
242 int level, | 247 int level, |
243 int raw, | 248 int raw, |
244 int windowBits, | 249 int windowBits, |
245 int memLevel, | 250 int memLevel, |
246 int strategy, | 251 int strategy, |
247 const char* password, | 252 const char* password, |
248 uLong crcForCrypting, | 253 uLong crcForCrypting, |
249 int zip64 | 254 int zip64); |
250 )); | |
251 | 255 |
252 /* | 256 /* |
253 Same than zipOpenNewFileInZip2, except | 257 Same than zipOpenNewFileInZip2, except |
254 windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 | 258 windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 |
255 password : crypting password (NULL for no crypting) | 259 password : crypting password (NULL for no crypting) |
256 crcForCrypting : crc of file to compress (needed for crypting) | 260 crcForCrypting : crc of file to compress (needed for crypting) |
257 */ | 261 */ |
258 | 262 |
259 extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, | 263 extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, |
260 const char* filename, | 264 const char* filename, |
261 const zip_fileinfo* zipfi, | 265 const zip_fileinfo* zipfi, |
262 const void* extrafield_local, | 266 const void* extrafield_local, |
263 uInt size_extrafield_local, | 267 uInt size_extrafield_local, |
264 const void* extrafield_global, | 268 const void* extrafield_global, |
265 uInt size_extrafield_global, | 269 uInt size_extrafield_global, |
266 const char* comment, | 270 const char* comment, |
267 int method, | 271 int method, |
268 int level, | 272 int level, |
269 int raw, | 273 int raw, |
270 int windowBits, | 274 int windowBits, |
271 int memLevel, | 275 int memLevel, |
272 int strategy, | 276 int strategy, |
273 const char* password, | 277 const char* password, |
274 uLong crcForCrypting, | 278 uLong crcForCrypting, |
275 uLong versionMadeBy, | 279 uLong versionMadeBy, |
276 uLong flagBase | 280 uLong flagBase); |
277 )); | 281 |
278 | 282 |
279 | 283 extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, |
280 extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, | 284 const char* filename, |
281 const char* filename, | 285 const zip_fileinfo* zipfi, |
282 const zip_fileinfo* zipfi, | 286 const void* extrafield_local, |
283 const void* extrafield_local, | 287 uInt size_extrafield_local, |
284 uInt size_extrafield_local, | 288 const void* extrafield_global, |
285 const void* extrafield_global, | 289 uInt size_extrafield_global, |
286 uInt size_extrafield_global, | 290 const char* comment, |
287 const char* comment, | 291 int method, |
288 int method, | 292 int level, |
289 int level, | 293 int raw, |
290 int raw, | 294 int windowBits, |
291 int windowBits, | 295 int memLevel, |
292 int memLevel, | 296 int strategy, |
293 int strategy, | 297 const char* password, |
294 const char* password, | 298 uLong crcForCrypting, |
295 uLong crcForCrypting, | 299 uLong versionMadeBy, |
296 uLong versionMadeBy, | 300 uLong flagBase, |
297 uLong flagBase, | 301 int zip64); |
298 int zip64 | |
299 )); | |
300 /* | 302 /* |
301 Same than zipOpenNewFileInZip4, except | 303 Same than zipOpenNewFileInZip4, except |
302 versionMadeBy : value for Version made by field | 304 versionMadeBy : value for Version made by field |
303 flag : value for flag field (compression level info will be added) | 305 flag : value for flag field (compression level info will be added) |
304 */ | 306 */ |
305 | 307 |
306 | 308 |
307 extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, | 309 extern int ZEXPORT zipWriteInFileInZip(zipFile file, |
308 const void* buf, | 310 const void* buf, |
309 unsigned len)); | 311 unsigned len); |
310 /* | 312 /* |
311 Write data in the zipfile | 313 Write data in the zipfile |
312 */ | 314 */ |
313 | 315 |
314 extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); | 316 extern int ZEXPORT zipCloseFileInZip(zipFile file); |
315 /* | 317 /* |
316 Close the current file in the zipfile | 318 Close the current file in the zipfile |
317 */ | 319 */ |
318 | 320 |
319 extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, | 321 extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, |
320 uLong uncompressed_size, | 322 uLong uncompressed_size, |
321 uLong crc32)); | 323 uLong crc32); |
322 | 324 |
323 extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, | 325 extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, |
324 ZPOS64_T uncompressed_size, | 326 ZPOS64_T uncompressed_size, |
325 uLong crc32)); | 327 uLong crc32); |
326 | 328 |
327 /* | 329 /* |
328 Close the current file in the zipfile, for file opened with | 330 Close the current file in the zipfile, for file opened with |
329 parameter raw=1 in zipOpenNewFileInZip2 | 331 parameter raw=1 in zipOpenNewFileInZip2 |
330 uncompressed_size and crc32 are value for the uncompressed size | 332 uncompressed_size and crc32 are value for the uncompressed size |
331 */ | 333 */ |
332 | 334 |
333 extern int ZEXPORT zipClose OF((zipFile file, | 335 extern int ZEXPORT zipClose(zipFile file, |
334 const char* global_comment)); | 336 const char* global_comment); |
335 /* | 337 /* |
336 Close the zipfile | 338 Close the zipfile |
337 */ | 339 */ |
338 | 340 |
339 | 341 |
340 extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); | 342 extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader); |
341 /* | 343 /* |
342 zipRemoveExtraInfoBlock - Added by Mathias Svensson | 344 zipRemoveExtraInfoBlock - Added by Mathias Svensson |
343 | 345 |
344 Remove extra information block from a extra information data for the local file header or central directory header | 346 Remove extra information block from a extra information data for the local file header or central directory header |
345 | 347 |