GeezerVison is showing github.com — deps: update zlib to 1.4-401d185 · nodejs/node@03b8203
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deps/zlib/contrib/minizip/unzip.c +5-3Lines changed: 5 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1054,14 +1054,16 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file, | 1054 | 1054 | /* dataSize includes version (1 byte), uCrc (4 bytes), and | 1055 | 1055 | * the filename data. If it's too small, fileNameSize below | 1056 | 1056 | * would overflow. */ | 1057 | | - err = UNZ_ERRNO; | 1058 | | - break; | | 1057 | + if (ZSEEK64(s->z_filefunc, s->filestream, dataSize, ZLIB_FILEFUNC_SEEK_CUR) != 0) | | 1058 | + { | | 1059 | + err = UNZ_ERRNO; | | 1060 | + } | 1059 | 1061 | } | 1060 | 1062 | else if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK) | 1061 | 1063 | { | 1062 | 1064 | err = UNZ_ERRNO; | 1063 | 1065 | } | 1064 | | - if (version != 1) | | 1066 | + else if (version != 1) | 1065 | 1067 | { | 1066 | 1068 | if (ZSEEK64(s->z_filefunc, s->filestream,dataSize - 1, ZLIB_FILEFUNC_SEEK_CUR) != 0) | 1067 | 1069 | { | |
Collapse file Copy file name to clipboardExpand all lines: deps/zlib/contrib/tests/utils_unittest.cc +37-1Lines changed: 37 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1438,7 +1438,15 @@ TEST(ZlibTest, ZipUnicodePathExtraSizeFilenameOverflow) { | 1438 | 1438 | base::FilePath zip_file = TestDataDir().AppendASCII("unicode_path_extra_overflow.zip"); | 1439 | 1439 | unzFile uzf = unzOpen(zip_file.AsUTF8Unsafe().c_str()); | 1440 | 1440 | ASSERT_NE(uzf, nullptr); | 1441 | | - EXPECT_EQ(unzGoToFirstFile(uzf), UNZ_ERRNO); | | 1441 | + | | 1442 | + char name[100]; | | 1443 | + unz_file_info file_info; | | 1444 | + ASSERT_EQ(unzGoToFirstFile(uzf), UNZ_OK); | | 1445 | + // The bad Unicode Path Extra Field should be ignored, and we get the regular | | 1446 | + // filename. | | 1447 | + ASSERT_EQ(unzGetCurrentFileInfo(uzf, &file_info, name, sizeof(name), nullptr, | | 1448 | + 0, nullptr, 0), UNZ_OK); | | 1449 | + ASSERT_EQ(std::string(name), "\xc8\xfe \xc8\xfe\xc8\xfe.txt"); | 1442 | 1450 | EXPECT_EQ(unzClose(uzf), UNZ_OK); | 1443 | 1451 | } | 1444 | 1452 |
| @@ -1482,6 +1490,34 @@ TEST(ZlibTest, ZipUnicodePathExtra) { | 1482 | 1490 | EXPECT_EQ(unzClose(uzf), UNZ_OK); | 1483 | 1491 | } | 1484 | 1492 |
| | 1493 | +TEST(ZlibTest, ShortZipUnicodePathExtra) { | | 1494 | + base::FilePath zip_file = TestDataDir().AppendASCII("short_unicode_path_extra.zip"); | | 1495 | + unzFile uzf = unzOpen(zip_file.AsUTF8Unsafe().c_str()); | | 1496 | + ASSERT_NE(uzf, nullptr); | | 1497 | + | | 1498 | + char name[100]; | | 1499 | + unz_file_info file_info; | | 1500 | + | | 1501 | + ASSERT_EQ(unzGoToFirstFile(uzf), UNZ_OK); | | 1502 | + ASSERT_EQ(unzGetCurrentFileInfo(uzf, &file_info, name, sizeof(name), nullptr, | | 1503 | + 0, nullptr, 0), UNZ_OK); | | 1504 | + ASSERT_EQ(std::string(name), "receipt.txt"); | | 1505 | + | | 1506 | + // The "decoy.dat" entry has an invalid (too short) Unicode Path Extra Field. | | 1507 | + // Ignore the extra field rather than erroring out. | | 1508 | + ASSERT_EQ(unzGoToNextFile(uzf), UNZ_OK); | | 1509 | + ASSERT_EQ(unzGetCurrentFileInfo(uzf, &file_info, name, sizeof(name), nullptr, | | 1510 | + 0, nullptr, 0), UNZ_OK); | | 1511 | + ASSERT_EQ(std::string(name), "decoy.dat"); | | 1512 | + | | 1513 | + ASSERT_EQ(unzGoToNextFile(uzf), UNZ_OK); | | 1514 | + ASSERT_EQ(unzGetCurrentFileInfo(uzf, &file_info, name, sizeof(name), nullptr, | | 1515 | + 0, nullptr, 0), UNZ_OK); | | 1516 | + ASSERT_EQ(std::string(name), "malware.exe"); | | 1517 | + | | 1518 | + EXPECT_EQ(unzClose(uzf), UNZ_OK); | | 1519 | +} | | 1520 | + | 1485 | 1521 | TEST(ZlibTest, ZipEncryptionFlagMismatch) { | 1486 | 1522 | // Test archive created with info-zip: | 1487 | 1523 | // $ echo -n a > a && zip -P a -k a.zip a | |
Collapse file Copy file name to clipboard Collapse file Copy file name to clipboardExpand all lines: deps/zlib/google/test_data.filelist +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,7 @@ test/data/enc_flag_mismatch.zip | 23 | 23 | test/data/evil.zip | 24 | 24 | test/data/evil_via_absolute_file_name.zip | 25 | 25 | test/data/evil_via_invalid_utf8.zip | | 26 | +test/data/short_unicode_path_extra.zip | 26 | 27 | test/data/symlink_absolute_path.zip | 27 | 28 | test/data/symlink_duplicate_link.zip | 28 | 29 | test/data/symlink_evil_relative_path.zip | |
Collapse file Copy file name to clipboardExpand all lines: deps/zlib/patches/0016-minizip-parse-unicode-path-extra-field.patch +22-8Lines changed: 22 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,6 +90,18 @@ Date: Mon Apr 27 13:24:27 2026 +0200 | 90 | 90 | Change-Id: I06e6c8a8ff8baa729b10a67a998f8804803ae6cd | 91 | 91 | Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7797172 | 92 | 92 |
| | 93 | +commit 14964355aff9695897f7a2e06a4af2c4e25b71d5 | | 94 | + | | 95 | +Date: Wed Sep 16 15:45:40 2026 +0200 | | 96 | + | | 97 | + [minizip] Ignore invalid Unicode Path Extra Fields rather than erroring | | 98 | + | | 99 | + To match what other extractors do. | | 100 | + | | 101 | + Bug: 553273868 | | 102 | + Change-Id: Ia5d64fb92d2abe5eba1e74f7180688a7a4362987 | | 103 | + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8418328 | | 104 | + | 93 | 105 | diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c | 94 | 106 | index fb5eb0bf0f852..c15f4484f75f7 100644 | 95 | 107 | --- a/third_party/zlib/contrib/minizip/unzip.c | @@ -102,7 +114,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644 | 102 | 114 | #include <stdio.h> | 103 | 115 | #include <stdlib.h> | 104 | 116 | #include <string.h> | 105 | | -@@ -195,6 +196,26 @@ typedef struct | | 117 | +@@ -195,6 +196,26 @@ | 106 | 118 | Reads a long in LSB order from the given gz_stream. Sets | 107 | 119 | */ | 108 | 120 |
| @@ -129,7 +141,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644 | 129 | 141 | local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, | 130 | 142 | voidpf filestream, | 131 | 143 | uLong *pX) { | 132 | | -@@ -780,6 +801,10 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file, | | 144 | +@@ -836,6 +857,10 @@ | 133 | 145 | uLong uMagic; | 134 | 146 | long lSeek=0; | 135 | 147 | uLong uL; | @@ -140,7 +152,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644 | 140 | 152 |
| 141 | 153 | if (file==NULL) | 142 | 154 | return UNZ_PARAMERROR; | 143 | | -@@ -851,21 +876,34 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file, | | 155 | +@@ -907,21 +932,34 @@ | 144 | 156 | file_info_internal.offset_curfile = uL; | 145 | 157 |
| 146 | 158 | lSeek+=file_info.size_filename; | @@ -186,7 +198,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644 | 186 | 198 | } | 187 | 199 |
| 188 | 200 | /* Read extrafield */ | 189 | | -@@ -951,6 +989,62 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file, | | 201 | +@@ -1007,6 +1045,64 @@ | 190 | 202 | } | 191 | 203 |
| 192 | 204 | } | @@ -199,14 +211,16 @@ index fb5eb0bf0f852..c15f4484f75f7 100644 | 199 | 211 | + /* dataSize includes version (1 byte), uCrc (4 bytes), and | 200 | 212 | + * the filename data. If it's too small, fileNameSize below | 201 | 213 | + * would overflow. */ | 202 | | -+ err = UNZ_ERRNO; | 203 | | -+ break; | | 214 | ++ if (ZSEEK64(s->z_filefunc, s->filestream, dataSize, ZLIB_FILEFUNC_SEEK_CUR) != 0) | | 215 | ++ { | | 216 | ++ err = UNZ_ERRNO; | | 217 | ++ } | 204 | 218 | + } | 205 | 219 | + else if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK) | 206 | 220 | + { | 207 | 221 | + err = UNZ_ERRNO; | 208 | 222 | + } | 209 | | -+ if (version != 1) | | 223 | ++ else if (version != 1) | 210 | 224 | + { | 211 | 225 | + if (ZSEEK64(s->z_filefunc, s->filestream,dataSize - 1, ZLIB_FILEFUNC_SEEK_CUR) != 0) | 212 | 226 | + { | @@ -249,7 +263,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644 | 249 | 263 | else | 250 | 264 | { | 251 | 265 | if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0) | 252 | | -@@ -1050,6 +1144,9 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, | | 266 | +@@ -1106,6 +1202,9 @@ | 253 | 267 | pfile_info->compressed_size = (uLong)file_info64.compressed_size; | 254 | 268 | pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; | 255 | 269 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/zlib_version.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | // Refer to tools/dep_updaters/update-zlib.sh | 3 | 3 | #ifndef SRC_ZLIB_VERSION_H_ | 4 | 4 | #define SRC_ZLIB_VERSION_H_ | 5 | | -#define ZLIB_VERSION "1.4-ec453dc" | | 5 | +#define ZLIB_VERSION "1.4-401d185" | 6 | 6 | #endif // SRC_ZLIB_VERSION_H_ |
|