Commit 49918c74aaa for nodejs
commit 49918c74aaa1f7671dd87e9e221557062f045e46
Author: Node.js GitHub Bot <github-bot@iojs.org>
Date: Mon Nov 23 19:45:45 2026 -0500
deps: update zlib to 1.4-401d185
PR-URL: https://github.com/nodejs/node/pull/67689
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
diff --git a/deps/zlib/contrib/minizip/unzip.c b/deps/zlib/contrib/minizip/unzip.c
index e45d0cf6365..c5e69721a8f 100644
--- a/deps/zlib/contrib/minizip/unzip.c
+++ b/deps/zlib/contrib/minizip/unzip.c
@@ -1054,14 +1054,16 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
/* dataSize includes version (1 byte), uCrc (4 bytes), and
* the filename data. If it's too small, fileNameSize below
* would overflow. */
- err = UNZ_ERRNO;
- break;
+ if (ZSEEK64(s->z_filefunc, s->filestream, dataSize, ZLIB_FILEFUNC_SEEK_CUR) != 0)
+ {
+ err = UNZ_ERRNO;
+ }
}
else if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK)
{
err = UNZ_ERRNO;
}
- if (version != 1)
+ else if (version != 1)
{
if (ZSEEK64(s->z_filefunc, s->filestream,dataSize - 1, ZLIB_FILEFUNC_SEEK_CUR) != 0)
{
diff --git a/deps/zlib/contrib/tests/utils_unittest.cc b/deps/zlib/contrib/tests/utils_unittest.cc
index 148cc7c6655..a9a40a755b6 100644
--- a/deps/zlib/contrib/tests/utils_unittest.cc
+++ b/deps/zlib/contrib/tests/utils_unittest.cc
@@ -1438,7 +1438,15 @@ TEST(ZlibTest, ZipUnicodePathExtraSizeFilenameOverflow) {
base::FilePath zip_file = TestDataDir().AppendASCII("unicode_path_extra_overflow.zip");
unzFile uzf = unzOpen(zip_file.AsUTF8Unsafe().c_str());
ASSERT_NE(uzf, nullptr);
- EXPECT_EQ(unzGoToFirstFile(uzf), UNZ_ERRNO);
+
+ char name[100];
+ unz_file_info file_info;
+ ASSERT_EQ(unzGoToFirstFile(uzf), UNZ_OK);
+ // The bad Unicode Path Extra Field should be ignored, and we get the regular
+ // filename.
+ ASSERT_EQ(unzGetCurrentFileInfo(uzf, &file_info, name, sizeof(name), nullptr,
+ 0, nullptr, 0), UNZ_OK);
+ ASSERT_EQ(std::string(name), "\xc8\xfe \xc8\xfe\xc8\xfe.txt");
EXPECT_EQ(unzClose(uzf), UNZ_OK);
}
@@ -1482,6 +1490,34 @@ TEST(ZlibTest, ZipUnicodePathExtra) {
EXPECT_EQ(unzClose(uzf), UNZ_OK);
}
+TEST(ZlibTest, ShortZipUnicodePathExtra) {
+ base::FilePath zip_file = TestDataDir().AppendASCII("short_unicode_path_extra.zip");
+ unzFile uzf = unzOpen(zip_file.AsUTF8Unsafe().c_str());
+ ASSERT_NE(uzf, nullptr);
+
+ char name[100];
+ unz_file_info file_info;
+
+ ASSERT_EQ(unzGoToFirstFile(uzf), UNZ_OK);
+ ASSERT_EQ(unzGetCurrentFileInfo(uzf, &file_info, name, sizeof(name), nullptr,
+ 0, nullptr, 0), UNZ_OK);
+ ASSERT_EQ(std::string(name), "receipt.txt");
+
+ // The "decoy.dat" entry has an invalid (too short) Unicode Path Extra Field.
+ // Ignore the extra field rather than erroring out.
+ ASSERT_EQ(unzGoToNextFile(uzf), UNZ_OK);
+ ASSERT_EQ(unzGetCurrentFileInfo(uzf, &file_info, name, sizeof(name), nullptr,
+ 0, nullptr, 0), UNZ_OK);
+ ASSERT_EQ(std::string(name), "decoy.dat");
+
+ ASSERT_EQ(unzGoToNextFile(uzf), UNZ_OK);
+ ASSERT_EQ(unzGetCurrentFileInfo(uzf, &file_info, name, sizeof(name), nullptr,
+ 0, nullptr, 0), UNZ_OK);
+ ASSERT_EQ(std::string(name), "malware.exe");
+
+ EXPECT_EQ(unzClose(uzf), UNZ_OK);
+}
+
TEST(ZlibTest, ZipEncryptionFlagMismatch) {
// Test archive created with info-zip:
// $ echo -n a > a && zip -P a -k a.zip a
diff --git a/deps/zlib/google/test/data/short_unicode_path_extra.zip b/deps/zlib/google/test/data/short_unicode_path_extra.zip
new file mode 100644
index 00000000000..f2ca0ffbb68
Binary files /dev/null and b/deps/zlib/google/test/data/short_unicode_path_extra.zip differ
diff --git a/deps/zlib/google/test_data.filelist b/deps/zlib/google/test_data.filelist
index 9761df11479..0e59c5144a9 100644
--- a/deps/zlib/google/test_data.filelist
+++ b/deps/zlib/google/test_data.filelist
@@ -23,6 +23,7 @@ test/data/enc_flag_mismatch.zip
test/data/evil.zip
test/data/evil_via_absolute_file_name.zip
test/data/evil_via_invalid_utf8.zip
+test/data/short_unicode_path_extra.zip
test/data/symlink_absolute_path.zip
test/data/symlink_duplicate_link.zip
test/data/symlink_evil_relative_path.zip
diff --git a/deps/zlib/patches/0016-minizip-parse-unicode-path-extra-field.patch b/deps/zlib/patches/0016-minizip-parse-unicode-path-extra-field.patch
index 412cfd681bb..2b2eb3375e5 100644
--- a/deps/zlib/patches/0016-minizip-parse-unicode-path-extra-field.patch
+++ b/deps/zlib/patches/0016-minizip-parse-unicode-path-extra-field.patch
@@ -90,6 +90,18 @@ Date: Mon Apr 27 13:24:27 2026 +0200
Change-Id: I06e6c8a8ff8baa729b10a67a998f8804803ae6cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7797172
+commit 14964355aff9695897f7a2e06a4af2c4e25b71d5
+Author: Hans Wennborg <hans@chromium.org>
+Date: Wed Sep 16 15:45:40 2026 +0200
+
+ [minizip] Ignore invalid Unicode Path Extra Fields rather than erroring
+
+ To match what other extractors do.
+
+ Bug: 553273868
+ Change-Id: Ia5d64fb92d2abe5eba1e74f7180688a7a4362987
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8418328
+
diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c
index fb5eb0bf0f852..c15f4484f75f7 100644
--- a/third_party/zlib/contrib/minizip/unzip.c
@@ -102,7 +114,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-@@ -195,6 +196,26 @@ typedef struct
+@@ -195,6 +196,26 @@
Reads a long in LSB order from the given gz_stream. Sets
*/
@@ -129,7 +141,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644
local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX) {
-@@ -780,6 +801,10 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
+@@ -836,6 +857,10 @@
uLong uMagic;
long lSeek=0;
uLong uL;
@@ -140,7 +152,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644
if (file==NULL)
return UNZ_PARAMERROR;
-@@ -851,21 +876,34 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
+@@ -907,21 +932,34 @@
file_info_internal.offset_curfile = uL;
lSeek+=file_info.size_filename;
@@ -186,7 +198,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644
}
/* Read extrafield */
-@@ -951,6 +989,62 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
+@@ -1007,6 +1045,64 @@
}
}
@@ -199,14 +211,16 @@ index fb5eb0bf0f852..c15f4484f75f7 100644
+ /* dataSize includes version (1 byte), uCrc (4 bytes), and
+ * the filename data. If it's too small, fileNameSize below
+ * would overflow. */
-+ err = UNZ_ERRNO;
-+ break;
++ if (ZSEEK64(s->z_filefunc, s->filestream, dataSize, ZLIB_FILEFUNC_SEEK_CUR) != 0)
++ {
++ err = UNZ_ERRNO;
++ }
+ }
+ else if (unz64local_getByte(&s->z_filefunc, s->filestream, &version) != UNZ_OK)
+ {
+ err = UNZ_ERRNO;
+ }
-+ if (version != 1)
++ else if (version != 1)
+ {
+ if (ZSEEK64(s->z_filefunc, s->filestream,dataSize - 1, ZLIB_FILEFUNC_SEEK_CUR) != 0)
+ {
@@ -249,7 +263,7 @@ index fb5eb0bf0f852..c15f4484f75f7 100644
else
{
if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)
-@@ -1050,6 +1144,9 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
+@@ -1106,6 +1202,9 @@
pfile_info->compressed_size = (uLong)file_info64.compressed_size;
pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size;
diff --git a/src/zlib_version.h b/src/zlib_version.h
index f99f6266691..696df9f6dff 100644
--- a/src/zlib_version.h
+++ b/src/zlib_version.h
@@ -2,5 +2,5 @@
// Refer to tools/dep_updaters/update-zlib.sh
#ifndef SRC_ZLIB_VERSION_H_
#define SRC_ZLIB_VERSION_H_
-#define ZLIB_VERSION "1.4-ec453dc"
+#define ZLIB_VERSION "1.4-401d185"
#endif // SRC_ZLIB_VERSION_H_