Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update zlib to 1.3.0.1-motley-5634698 #56655

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deps/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ if (BUILD_MINIZIP_BIN)
add_executable(minizip_bin contrib/minizip/minizip.c contrib/minizip/ioapi.c
contrib/minizip/ioapi.h contrib/minizip/unzip.c
contrib/minizip/unzip.h contrib/minizip/zip.c contrib/minizip/zip.h
contrib/minizip/ints.h contrib/minizip/skipset.h
)
target_link_libraries(minizip_bin zlib)
endif()
Expand Down
11 changes: 6 additions & 5 deletions deps/zlib/contrib/bench/zlib_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
* g++|clang++ -O3 -Wall -std=c++11 zlib_bench.cc -lstdc++ -lz
*/

#include <memory.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include <algorithm>
#include <chrono>
#include <fstream>
#include <memory>
#include <new>
#include <string>
#include <vector>

#include <memory.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include "zlib.h"

void error_exit(const char* error, int code) {
Expand Down
18 changes: 13 additions & 5 deletions deps/zlib/contrib/minizip/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC=cc
CFLAGS := $(CFLAGS) -O -I../..
CC?=cc
CFLAGS := -O $(CFLAGS) -I../..

UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
Expand All @@ -9,13 +9,21 @@ ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a

all: miniunz minizip

miniunz: $(UNZ_OBJS)
miniunz.o: miniunz.c unzip.h iowin32.h
minizip.o: minizip.c zip.h iowin32.h ints.h
unzip.o: unzip.c unzip.h crypt.h
zip.o: zip.c zip.h crypt.h skipset.h ints.h
ioapi.o: ioapi.c ioapi.h ints.h
iowin32.o: iowin32.c iowin32.h ioapi.h
mztools.o: mztools.c unzip.h

miniunz: $(UNZ_OBJS)
$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)

minizip: $(ZIP_OBJS)
minizip: $(ZIP_OBJS)
$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)

test: miniunz minizip
test: miniunz minizip
@rm -f test.*
@echo hello hello hello > test.txt
./minizip test test.txt
Expand Down
11 changes: 9 additions & 2 deletions deps/zlib/contrib/minizip/README.chromium
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Name: ZIP file API for reading file entries in a ZIP archive
Short Name: minizip
URL: https://github.com/madler/zlib/tree/master/contrib/minizip
Version: 1.3.0.1
Revision: 643e17b7498d12ab8d15565662880579692f769d
Version: 1.3.1.1
Revision: ef24c4c7502169f016dcd2a26923dbaf3216748c
License: Zlib
License File: //third_party/zlib/LICENSE
Shipped: yes
Expand All @@ -14,6 +14,13 @@ Minizip provides API on top of zlib that can enumerate and extract ZIP archive
files. See minizip.md for chromium build instructions.

Local Modifications:
- OS macro tweaks for Android and Fuchsia
0000-build.patch (the contrib/minizip/ parts)
0008-minizip-zip-unzip-tools.patch (crrev.com/886990)

- Fix build on UWP. (crrev.com/750639)
0004-fix-uwp.patch

- Fixed uncompressing files with wrong uncompressed size set
crrev.com/268940
0014-minizip-unzip-with-incorrect-size.patch
Expand Down
57 changes: 57 additions & 0 deletions deps/zlib/contrib/minizip/ints.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* ints.h -- create integer types for 8, 16, 32, and 64 bits
* Copyright (C) 2024 Mark Adler
* For conditions of distribution and use, see the copyright notice in zlib.h
*
* There exist compilers with limits.h, but not stdint.h or inttypes.h.
*/

#ifndef INTS_H
#define INTS_H
#include <limits.h>
#if defined(UCHAR_MAX) && UCHAR_MAX == 0xff
typedef signed char i8_t;
typedef unsigned char ui8_t;
#else
# error "no 8-bit integer"
#endif
#if defined(USHRT_MAX) && USHRT_MAX == 0xffff
typedef short i16_t;
typedef unsigned short ui16_t;
#elif defined(UINT_MAX) && UINT_MAX == 0xffff
typedef int i16_t;
typedef unsigned ui16_t;
#else
# error "no 16-bit integer"
#endif
#if defined(UINT_MAX) && UINT_MAX == 0xffffffff
typedef int i32_t;
typedef unsigned ui32_t;
# define PI32 "d"
# define PUI32 "u"
#elif defined(ULONG_MAX) && ULONG_MAX == 0xffffffff
typedef long i32_t;
typedef unsigned long ui32_t;
# define PI32 "ld"
# define PUI32 "lu"
#else
# error "no 32-bit integer"
#endif
#if defined(ULONG_MAX) && ULONG_MAX == 0xffffffffffffffff
typedef long i64_t;
typedef unsigned long ui64_t;
# define PI64 "ld"
# define PUI64 "lu"
#elif defined(ULLONG_MAX) && ULLONG_MAX == 0xffffffffffffffff
typedef long long i64_t;
typedef unsigned long long ui64_t;
# define PI64 "lld"
# define PUI64 "llu"
#elif defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xffffffffffffffff
typedef long long i64_t;
typedef unsigned long long ui64_t;
# define PI64 "lld"
# define PUI64 "llu"
#else
# error "no 64-bit integer"
#endif
#endif
35 changes: 4 additions & 31 deletions deps/zlib/contrib/minizip/ioapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

*/

#ifndef _ZLIBIOAPI64_H
#define _ZLIBIOAPI64_H
#ifndef ZLIBIOAPI64_H
#define ZLIBIOAPI64_H

#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))

Expand Down Expand Up @@ -67,39 +67,12 @@
#endif
#endif

/*
#ifndef ZPOS64_T
#ifdef _WIN32
#define ZPOS64_T fpos_t
#else
#include <stdint.h>
#define ZPOS64_T uint64_t
#endif
#endif
*/

#ifdef HAVE_MINIZIP64_CONF_H
#include "mz64conf.h"
#endif

/* a type chosen by DEFINE */
#ifdef HAVE_64BIT_INT_CUSTOM
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
#else
#ifdef HAS_STDINT_H
#include "stdint.h"
typedef uint64_t ZPOS64_T;
#else



#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ZPOS64_T;
#else
typedef unsigned long long int ZPOS64_T;
#endif
#endif
#endif
#include "ints.h"
typedef ui64_t ZPOS64_T;

/* Maximum unsigned 32-bit value used as placeholder for zip64 */
#ifndef MAXU32
Expand Down
16 changes: 12 additions & 4 deletions deps/zlib/contrib/minizip/iowin32.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static voidpf win32_build_iowin(HANDLE hFile) {
}

voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) {
const char* mode_fopen = NULL;
(void)opaque;
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
HANDLE hFile = NULL;

Expand Down Expand Up @@ -116,7 +116,7 @@ voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int


voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) {
const char* mode_fopen = NULL;
(void)opaque;
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
HANDLE hFile = NULL;

Expand All @@ -139,7 +139,7 @@ voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, in


voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) {
const char* mode_fopen = NULL;
(void)opaque;
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
HANDLE hFile = NULL;

Expand All @@ -158,7 +158,7 @@ voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, in


voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) {
const char* mode_fopen = NULL;
(void)opaque;
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
HANDLE hFile = NULL;

Expand Down Expand Up @@ -186,6 +186,7 @@ voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int m


uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) {
(void)opaque;
uLong ret=0;
HANDLE hFile = NULL;
if (stream!=NULL)
Expand All @@ -207,6 +208,7 @@ uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLo


uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
(void)opaque;
uLong ret=0;
HANDLE hFile = NULL;
if (stream!=NULL)
Expand Down Expand Up @@ -246,6 +248,7 @@ static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *n
}

long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
(void)opaque;
long ret=-1;
HANDLE hFile = NULL;
if (stream!=NULL)
Expand All @@ -268,6 +271,7 @@ long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
}

ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
(void)opaque;
ZPOS64_T ret= (ZPOS64_T)-1;
HANDLE hFile = NULL;
if (stream!=NULL)
Expand All @@ -292,6 +296,7 @@ ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {


long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
(void)opaque;
DWORD dwMoveMethod=0xFFFFFFFF;
HANDLE hFile = NULL;

Expand Down Expand Up @@ -329,6 +334,7 @@ long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset,
}

long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
(void)opaque;
DWORD dwMoveMethod=0xFFFFFFFF;
HANDLE hFile = NULL;
long ret=-1;
Expand Down Expand Up @@ -367,6 +373,7 @@ long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T off
}

int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
(void)opaque;
int ret=-1;

if (stream!=NULL)
Expand All @@ -384,6 +391,7 @@ int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
}

int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) {
(void)opaque;
int ret=-1;
if (stream!=NULL)
{
Expand Down
32 changes: 24 additions & 8 deletions deps/zlib/contrib/minizip/miniunz.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
#endif


#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -79,10 +82,11 @@

/* change_file_date : change the date/time of a file
filename : the filename of the file where date/time must be modified
dosdate : the new date at the MSDos format (4 bytes)
dosdate : the new date at the MSDOS format (4 bytes)
tmu_date : the SAME new date at the tm_unz format */
static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) {
#ifdef _WIN32
(void)tmu_date;
HANDLE hFile;
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;

Expand All @@ -93,8 +97,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
LocalFileTimeToFileTime(&ftLocal,&ftm);
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
CloseHandle(hFile);
#else
#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
(void)dosdate;
struct utimbuf ut;
struct tm newdate;
Expand All @@ -116,7 +119,6 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
(void)dosdate;
(void)tmu_date;
#endif
#endif
}


Expand All @@ -125,9 +127,9 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat

static int mymkdir(const char* dirname) {
int ret=0;
#if defined(_WIN32)
#ifdef _WIN32
ret = _mkdir(dirname);
#elif defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
#elif defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
ret = mkdir (dirname,0775);
#else
(void)dirname;
Expand Down Expand Up @@ -238,7 +240,7 @@ static int do_list(unzFile uf) {
printf(" ------ ------ ---- ----- ---- ---- ------ ----\n");
for (i=0;i<gi.number_entry;i++)
{
char filename_inzip[256];
char filename_inzip[65536+1];
unz_file_info64 file_info;
uLong ratio=0;
const char *string_method = "";
Expand Down Expand Up @@ -303,7 +305,7 @@ static int do_list(unzFile uf) {


static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
char filename_inzip[256];
char filename_inzip[65536+1];
char* filename_withoutpath;
char* p;
int err=UNZ_OK;
Expand Down Expand Up @@ -354,6 +356,20 @@ static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_pa
else
write_filename = filename_withoutpath;

if (write_filename[0]!='\0')
{
const char* relative_check = write_filename;
while (relative_check[1]!='\0')
{
if (relative_check[0]=='.' && relative_check[1]=='.')
write_filename = relative_check;
relative_check++;
}
}

while (write_filename[0]=='/' || write_filename[0]=='.')
write_filename++;

err = unzOpenCurrentFilePassword(uf,password);
if (err!=UNZ_OK)
{
Expand Down
Loading
Loading