mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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>
This commit is contained in:
1 parent
ebad21ba08
commit
bc8732f31d
6 files changed
+66
-13
No files matched your search
Vendored
+5
-3
@@ -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)
|
||||
{
|
||||
|
||||
+37
-1
@@ -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
|
||||
|
||||
Binary file not shown.
Vendored
+1
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
+1
-1
@@ -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_
|
||||
Reference in new issue
Block a user