Skip to content

Commit

Permalink
deps: update zlib to 1.3.0.1-motley-7e2e4d7
Browse files Browse the repository at this point in the history
PR-URL: nodejs#54432
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
  • Loading branch information
nodejs-github-bot authored and Ceres6 committed Nov 26, 2024
1 parent 4dd2ef1 commit 4c82a25
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
1 change: 1 addition & 0 deletions deps/zlib/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Name: zlib
Short Name: zlib
URL: http://zlib.net/
Version: 1.3.0.1
Revision: ac8f12c97d1afd9bafa9c710f827d40a407d3266
CPEPrefix: cpe:/a:zlib:zlib:1.3.0.1
Security Critical: yes
Shipped: yes
Expand Down
9 changes: 3 additions & 6 deletions deps/zlib/google/zip_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ struct ZipBuffer {
// writing compressed data and it returns NULL for this case.)
void* OpenZipBuffer(void* opaque, const void* /*filename*/, int mode) {
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) != ZLIB_FILEFUNC_MODE_READ) {
NOTREACHED_IN_MIGRATION();
return NULL;
NOTREACHED();
}
ZipBuffer* buffer = static_cast<ZipBuffer*>(opaque);
if (!buffer || !buffer->data || !buffer->length)
Expand Down Expand Up @@ -196,8 +195,7 @@ uLong WriteZipBuffer(void* /*opaque*/,
void* /*stream*/,
const void* /*buf*/,
uLong /*size*/) {
NOTREACHED_IN_MIGRATION();
return 0;
NOTREACHED();
}

// Returns the offset from the beginning of the data.
Expand Down Expand Up @@ -228,8 +226,7 @@ long SeekZipBuffer(void* opaque,
buffer->offset = std::min(buffer->length, offset);
return 0;
}
NOTREACHED_IN_MIGRATION();
return -1;
NOTREACHED();
}

// Closes the input offset and deletes all resources used for compressing or
Expand Down
7 changes: 4 additions & 3 deletions deps/zlib/google/zip_reader_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <string.h>

#include <iterator>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
Expand Down Expand Up @@ -555,10 +556,10 @@ TEST_F(ZipReaderTest, ExtractToFileAsync_RegularFile) {
const std::string md5 = base::MD5String(output);
EXPECT_EQ(kQuuxExpectedMD5, md5);

int64_t file_size = 0;
ASSERT_TRUE(base::GetFileSize(target_file, &file_size));
std::optional<int64_t> file_size = base::GetFileSize(target_file);
ASSERT_TRUE(file_size.has_value());

EXPECT_EQ(file_size, listener.current_progress());
EXPECT_EQ(file_size.value(), listener.current_progress());
}

TEST_F(ZipReaderTest, ExtractToFileAsync_Encrypted_NoPassword) {
Expand Down
37 changes: 20 additions & 17 deletions deps/zlib/google/zip_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ bool CreateFile(const std::string& content,
if (!base::CreateTemporaryFile(file_path))
return false;

if (base::WriteFile(*file_path, content.data(), content.size()) == -1)
if (!base::WriteFile(*file_path, content)) {
return false;
}

*file = base::File(
*file_path, base::File::Flags::FLAG_OPEN | base::File::Flags::FLAG_READ);
Expand Down Expand Up @@ -350,7 +351,7 @@ class ZipTest : public PlatformTest {
base::Time now_time;
EXPECT_TRUE(base::Time::FromUTCExploded(now_parts, &now_time));

EXPECT_EQ(1, base::WriteFile(src_file, "1", 1));
EXPECT_TRUE(base::WriteFile(src_file, "1"));
EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime));

EXPECT_TRUE(zip::Zip(src_dir, zip_file, true));
Expand Down Expand Up @@ -748,6 +749,8 @@ TEST_F(ZipTest, UnzipMixedPaths) {
"Space→", //
#else
" ", //
"...", // Disappears on Windows
"....", // Disappears on Windows
"AUX", // Disappears on Windows
"COM1", // Disappears on Windows
"COM2", // Disappears on Windows
Expand Down Expand Up @@ -1113,9 +1116,9 @@ TEST_F(ZipTest, UnzipFilesWithIncorrectSize) {
SCOPED_TRACE(base::StringPrintf("Processing %d.txt", i));
base::FilePath file_path =
temp_dir.AppendASCII(base::StringPrintf("%d.txt", i));
int64_t file_size = -1;
EXPECT_TRUE(base::GetFileSize(file_path, &file_size));
EXPECT_EQ(static_cast<int64_t>(i), file_size);
std::optional<int64_t> file_size = base::GetFileSize(file_path);
EXPECT_TRUE(file_size.has_value());
EXPECT_EQ(static_cast<int64_t>(i), file_size.value());
}
}

Expand Down Expand Up @@ -1306,10 +1309,10 @@ TEST_F(ZipTest, Compressed) {

// Since the source files compress well, the destination ZIP file should be
// smaller than the source files.
int64_t dest_file_size;
ASSERT_TRUE(base::GetFileSize(dest_file, &dest_file_size));
EXPECT_GT(dest_file_size, 300);
EXPECT_LT(dest_file_size, 1000);
std::optional<int64_t> dest_file_size = base::GetFileSize(dest_file);
ASSERT_TRUE(dest_file_size.has_value());
EXPECT_GT(dest_file_size.value(), 300);
EXPECT_LT(dest_file_size.value(), 1000);
}

// Tests that a ZIP put inside a ZIP is simply stored instead of being
Expand Down Expand Up @@ -1338,10 +1341,10 @@ TEST_F(ZipTest, NestedZip) {
// Since the dummy source (inner) ZIP file should simply be stored in the
// destination (outer) ZIP file, the destination file should be bigger than
// the source file, but not much bigger.
int64_t dest_file_size;
ASSERT_TRUE(base::GetFileSize(dest_file, &dest_file_size));
EXPECT_GT(dest_file_size, src_size + 100);
EXPECT_LT(dest_file_size, src_size + 300);
std::optional<int64_t> dest_file_size = base::GetFileSize(dest_file);
ASSERT_TRUE(dest_file_size.has_value());
EXPECT_GT(dest_file_size.value(), src_size + 100);
EXPECT_LT(dest_file_size.value(), src_size + 300);
}

// Tests that there is no 2GB or 4GB limits. Tests that big files can be zipped
Expand Down Expand Up @@ -1402,10 +1405,10 @@ TEST_F(ZipTest, BigFile) {
// Since the dummy source (inner) ZIP file should simply be stored in the
// destination (outer) ZIP file, the destination file should be bigger than
// the source file, but not much bigger.
int64_t dest_file_size;
ASSERT_TRUE(base::GetFileSize(dest_file, &dest_file_size));
EXPECT_GT(dest_file_size, src_size + 100);
EXPECT_LT(dest_file_size, src_size + 300);
std::optional<int64_t> dest_file_size = base::GetFileSize(dest_file);
ASSERT_TRUE(dest_file_size.has_value());
EXPECT_GT(dest_file_size.value(), src_size + 100);
EXPECT_LT(dest_file_size.value(), src_size + 300);

LOG(INFO) << "Reading big ZIP " << dest_file;
zip::ZipReader reader;
Expand Down
2 changes: 1 addition & 1 deletion src/zlib_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.0.1-motley-71660e1"
#define ZLIB_VERSION "1.3.0.1-motley-7e2e4d7"
#endif // SRC_ZLIB_VERSION_H_

0 comments on commit 4c82a25

Please sign in to comment.