Skip to content

Commit 9916750

Browse files
deps: update zlib to 1.3.1-3102d2a
1 parent b890c51 commit 9916750

File tree

8 files changed

+60
-5
lines changed

8 files changed

+60
-5
lines changed

deps/zlib/README.chromium

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Short Name: zlib
33
URL: http://zlib.net/
44
Version: 1.3.1
55
Revision: 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf
6+
Update Mechanism: Manual
67
CPEPrefix: cpe:/a:zlib:zlib:1.3.1
78
Security Critical: yes
89
Shipped: yes

deps/zlib/contrib/minizip/README.chromium

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Short Name: minizip
33
URL: https://github.com/madler/zlib/tree/master/contrib/minizip
44
Version: 1.3.1.1
55
Revision: ef24c4c7502169f016dcd2a26923dbaf3216748c
6+
Update Mechanism: Manual
67
License: Zlib
78
License File: //third_party/zlib/LICENSE
89
Shipped: yes

deps/zlib/contrib/minizip/unzip.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,15 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
10121012
{
10131013
int version = 0;
10141014

1015-
if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK)
1015+
if (dataSize < 1 + 4)
1016+
{
1017+
/* dataSize includes version (1 byte), uCrc (4 bytes), and
1018+
* the filename data. If it's too small, fileNameSize below
1019+
* would overflow. */
1020+
err = UNZ_ERRNO;
1021+
break;
1022+
}
1023+
else if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK)
10161024
{
10171025
err = UNZ_ERRNO;
10181026
}
@@ -1032,7 +1040,7 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
10321040
err = UNZ_ERRNO;
10331041
}
10341042
uHeaderCrc = crc32(0, (const unsigned char *)szFileName, file_info.size_filename);
1035-
fileNameSize = dataSize - (2 * sizeof (short) + 1);
1043+
fileNameSize = dataSize - (1 + 4); /* 1 for version, 4 for uCrc */
10361044
/* Check CRC against file name in the header. */
10371045
if (uHeaderCrc != uCrc)
10381046
{

deps/zlib/contrib/tests/utils_unittest.cc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#if !defined(CMAKE_STANDALONE_UNITTESTS)
1414
#include "base/files/file_path.h"
1515
#include "base/files/scoped_temp_dir.h"
16+
#include "base/path_service.h"
1617

1718
#include "third_party/zlib/contrib/minizip/unzip.h"
1819
#include "third_party/zlib/contrib/minizip/zip.h"
@@ -1287,4 +1288,27 @@ TEST(ZlibTest, ZipExtraFieldSize) {
12871288
EXPECT_EQ(unzClose(uzf), UNZ_OK);
12881289
}
12891290

1291+
static base::FilePath TestDataDir() {
1292+
base::FilePath path;
1293+
bool success = base::PathService::Get(base::DIR_SRC_TEST_DATA_ROOT, &path);
1294+
EXPECT_TRUE(success);
1295+
return path
1296+
.AppendASCII("third_party")
1297+
.AppendASCII("zlib")
1298+
.AppendASCII("google")
1299+
.AppendASCII("test")
1300+
.AppendASCII("data");
1301+
}
1302+
1303+
TEST(ZlibTest, ZipUnicodePathExtraSizeFilenameOverflow) {
1304+
// This is based on components/test/data/unzip_service/bug953599.zip (added
1305+
// in https://crrev.com/1004132), with the Unicode Path Extra Field's
1306+
// dataSize hex edited to four.
1307+
base::FilePath zip_file = TestDataDir().AppendASCII("unicode_path_extra_overflow.zip");
1308+
unzFile uzf = unzOpen(zip_file.AsUTF8Unsafe().c_str());
1309+
ASSERT_NE(uzf, nullptr);
1310+
EXPECT_EQ(unzGoToFirstFile(uzf), UNZ_ERRNO);
1311+
EXPECT_EQ(unzClose(uzf), UNZ_OK);
1312+
}
1313+
12901314
#endif
Binary file not shown.

deps/zlib/google/test_data.filelist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ test/data/test_encrypted.zip
3737
test/data/test_mismatch_size.zip
3838
test/data/test_nocompress.zip
3939
test/data/test_posix_permissions.zip
40+
test/data/unicode_path_extra_overflow.zip

deps/zlib/patches/0016-minizip-parse-unicode-path-extra-field.patch

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ Date: Fri May 16 15:48:19 2025 +0200
3535
Change-Id: Ifab65f470736b45b1b51a1cc130a5753a2b20583
3636
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6553931
3737

38+
commit 9f6e08ef47d3bc9438fdc3b1ab77126a7b36cce9
39+
Author: Hans Wennborg <[email protected]>
40+
Date: Thu Jul 3 17:47:55 2025 +0200
41+
42+
[minizip] Fix Unicode Path Extra Field filename length overflow
43+
44+
If dataSize is too small, fileNameSize would overflow.
45+
46+
Bug: 428744375
47+
Change-Id: I714fc1e30cb1634c31cb97ce87be225518368e57
48+
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6701714
49+
3850
diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c
3951
index c8a01b23efd42..42677cff82c96 100644
4052
--- a/third_party/zlib/contrib/minizip/unzip.c
@@ -74,7 +86,15 @@ index c8a01b23efd42..42677cff82c96 100644
7486
+ {
7587
+ int version = 0;
7688
+
77-
+ if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK)
89+
+ if (dataSize < 1 + 4)
90+
+ {
91+
+ /* dataSize includes version (1 byte), uCrc (4 bytes), and
92+
+ * the filename data. If it's too small, fileNameSize below
93+
+ * would overflow. */
94+
+ err = UNZ_ERRNO;
95+
+ break;
96+
+ }
97+
+ else if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK)
7898
+ {
7999
+ err = UNZ_ERRNO;
80100
+ }
@@ -94,7 +114,7 @@ index c8a01b23efd42..42677cff82c96 100644
94114
+ err = UNZ_ERRNO;
95115
+ }
96116
+ uHeaderCrc = crc32(0, (const unsigned char *)szFileName, file_info.size_filename);
97-
+ fileNameSize = dataSize - (2 * sizeof (short) + 1);
117+
+ fileNameSize = dataSize - (1 + 4); /* 1 for version, 4 for uCrc */
98118
+ /* Check CRC against file name in the header. */
99119
+ if (uHeaderCrc != uCrc)
100120
+ {

src/zlib_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// Refer to tools/dep_updaters/update-zlib.sh
33
#ifndef SRC_ZLIB_VERSION_H_
44
#define SRC_ZLIB_VERSION_H_
5-
#define ZLIB_VERSION "1.3.1-470d3a2"
5+
#define ZLIB_VERSION "1.3.1-3102d2a"
66
#endif // SRC_ZLIB_VERSION_H_

0 commit comments

Comments
 (0)