Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7bea2d7

Browse files
nodejs-github-botrichardlau
authored andcommitted
deps: update zlib to 1.3.0.1-motley-40e35a7
PR-URL:#51274Reviewed-By: Luigi Pinca <luigipinca@gmail.com>Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent57a38c8 commit7bea2d7

File tree

7 files changed

+82
-17
lines changed

7 files changed

+82
-17
lines changed

‎deps/zlib/BUILD.gn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# found in the LICENSE file.
44

55
import("//build/config/compiler/compiler.gni")
6+
import("//build/config/dcheck_always_on.gni")
67

78
declare_args() {
89
# Expose zlib's symbols, used by Node.js to provide zlib APIs for its native
@@ -33,7 +34,7 @@ config("zlib_internal_config") {
3334
# Build code using -O3, see: crbug.com/1084371.
3435
configs= ["//build/config/compiler:optimize_speed" ]
3536
}
36-
if (is_debug||use_fuzzing_engine) {
37+
if (is_debug||dcheck_always_on||use_fuzzing_engine) {
3738
# Enable zlib's asserts in debug and fuzzer builds.
3839
defines+= ["ZLIB_DEBUG" ]
3940
}

‎deps/zlib/contrib/tests/utils_unittest.cc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,61 @@ TEST(ZlibTest, DeflateZFixedCorruption) {
10251025
0);
10261026
}
10271027

1028+
TEST(ZlibTest, DeflateCopy) {
1029+
// Check that deflateCopy() works.
1030+
1031+
z_stream stream1;
1032+
stream1.zalloc = Z_NULL;
1033+
stream1.zfree = Z_NULL;
1034+
int ret =
1035+
deflateInit(&stream1, Z_DEFAULT_COMPRESSION);
1036+
ASSERT_EQ(ret, Z_OK);
1037+
std::vector<uint8_t>compressed(
1038+
deflateBound(&stream1,strlen(zFixedCorruptionData)));
1039+
stream1.next_out = compressed.data();
1040+
stream1.avail_out = compressed.size();
1041+
1042+
// Compress the first 1000 bytes.
1043+
stream1.next_in = (uint8_t*)zFixedCorruptionData;
1044+
stream1.avail_in =1000;
1045+
ret =deflate(&stream1, Z_NO_FLUSH);
1046+
ASSERT_EQ(ret, Z_OK);
1047+
1048+
// Copy the stream state.
1049+
z_stream stream2;
1050+
ret =deflateCopy(&stream2, &stream1);
1051+
ASSERT_EQ(ret, Z_OK);
1052+
deflateEnd(&stream1);
1053+
1054+
// Compress the remaining bytes.
1055+
stream2.next_in = (uint8_t*)zFixedCorruptionData + (1000 - stream2.avail_in);
1056+
stream2.avail_in =strlen(zFixedCorruptionData) - (1000 - stream2.avail_in);
1057+
ret =deflate(&stream2, Z_FINISH);
1058+
ASSERT_EQ(ret, Z_STREAM_END);
1059+
size_t compressed_sz = compressed.size() - stream2.avail_out;
1060+
deflateEnd(&stream2);
1061+
1062+
// Check that decompression is successful.
1063+
std::vector<uint8_t>decompressed(strlen(zFixedCorruptionData));
1064+
z_stream stream;
1065+
stream.zalloc = Z_NULL;
1066+
stream.zfree = Z_NULL;
1067+
ret =inflateInit(&stream);
1068+
ASSERT_EQ(ret, Z_OK);
1069+
stream.next_in = compressed.data();
1070+
stream.avail_in = compressed_sz;
1071+
stream.next_out = decompressed.data();
1072+
stream.avail_out = decompressed.size();
1073+
ret =inflate(&stream, Z_FINISH);
1074+
ASSERT_EQ(ret, Z_STREAM_END);
1075+
inflateEnd(&stream);
1076+
1077+
EXPECT_EQ(decompressed.size(),strlen(zFixedCorruptionData));
1078+
EXPECT_EQ(
1079+
memcmp(zFixedCorruptionData, decompressed.data(), decompressed.size()),
1080+
0);
1081+
}
1082+
10281083
// TODO(gustavoa): make these tests run standalone.
10291084
#ifndef CMAKE_STANDALONE_UNITTESTS
10301085

‎deps/zlib/deflate.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,11 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
13451345
ds->window= (Bytef*)ZALLOC(dest,ds->w_size,2*sizeof(Byte));
13461346
ds->prev= (Posf*)ZALLOC(dest,ds->w_size,sizeof(Pos));
13471347
ds->head= (Posf*)ZALLOC(dest,ds->hash_size,sizeof(Pos));
1348+
#ifdefLIT_MEM
1349+
ds->pending_buf= (uchf*)ZALLOC(dest,ds->lit_bufsize,5);
1350+
#else
13481351
ds->pending_buf= (uchf*)ZALLOC(dest,ds->lit_bufsize,4);
1352+
#endif
13491353

13501354
if (ds->window==Z_NULL||ds->prev==Z_NULL||ds->head==Z_NULL||
13511355
ds->pending_buf==Z_NULL) {
@@ -1356,7 +1360,11 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
13561360
zmemcpy(ds->window,ss->window,ds->w_size*2*sizeof(Byte));
13571361
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev,ds->w_size*sizeof(Pos));
13581362
zmemcpy((voidpf)ds->head, (voidpf)ss->head,ds->hash_size*sizeof(Pos));
1363+
#ifdefLIT_MEM
1364+
zmemcpy(ds->pending_buf,ss->pending_buf, (uInt)ds->lit_bufsize*5);
1365+
#else
13591366
zmemcpy(ds->pending_buf,ss->pending_buf, (uInt)ds->pending_buf_size);
1367+
#endif
13601368

13611369
ds->pending_out=ds->pending_buf+ (ss->pending_out-ss->pending_buf);
13621370
#ifdefLIT_MEM

‎deps/zlib/deflate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at
2727
the cost of a larger memory footprint */
28-
/*#define LIT_MEM */
28+
#defineLIT_MEM
2929

3030
/* ===========================================================================
3131
* Internal compression state.

‎deps/zlib/google/compression_utils.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include"third_party/zlib/google/compression_utils.h"
66

7-
#include"base/bit_cast.h"
87
#include"base/check_op.h"
98
#include"base/process/memory.h"
109
#include"base/sys_byteorder.h"
@@ -24,8 +23,8 @@ bool GzipCompress(base::span<const char> input,
2423
// uLongf can be larger than size_t.
2524
uLongf compressed_size_long =static_cast<uLongf>(output_buffer_size);
2625
if (zlib_internal::GzipCompressHelper(
27-
base::bit_cast<Bytef*>(output_buffer), &compressed_size_long,
28-
base::bit_cast<const Bytef*>(input.data()),
26+
reinterpret_cast<Bytef*>(output_buffer), &compressed_size_long,
27+
reinterpret_cast<const Bytef*>(input.data()),
2928
static_cast<uLongf>(input.size()), malloc_fn, free_fn) != Z_OK) {
3029
returnfalse;
3130
}
@@ -55,7 +54,7 @@ bool GzipCompress(base::span<const uint8_t> input, std::string* output) {
5554

5655
if (zlib_internal::GzipCompressHelper(
5756
compressed_data, &compressed_data_size,
58-
base::bit_cast<const Bytef*>(input.data()), input_size,nullptr,
57+
reinterpret_cast<const Bytef*>(input.data()), input_size,nullptr,
5958
nullptr) != Z_OK) {
6059
free(compressed_data);
6160
returnfalse;
@@ -82,8 +81,8 @@ bool GzipUncompress(const std::string& input, std::string* output) {
8281

8382
uncompressed_output.resize(uncompressed_size);
8483
if (zlib_internal::GzipUncompressHelper(
85-
base::bit_cast<Bytef*>(uncompressed_output.data()),
86-
&uncompressed_size,base::bit_cast<const Bytef*>(input.data()),
84+
reinterpret_cast<Bytef*>(uncompressed_output.data()),
85+
&uncompressed_size,reinterpret_cast<const Bytef*>(input.data()),
8786
static_cast<uLongf>(input.length())) == Z_OK) {
8887
output->swap(uncompressed_output);
8988
returntrue;
@@ -102,8 +101,8 @@ bool GzipUncompress(base::span<const uint8_t> input,
102101
if (uncompressed_size > output.size())
103102
returnfalse;
104103
returnzlib_internal::GzipUncompressHelper(
105-
base::bit_cast<Bytef*>(output.data()), &uncompressed_size,
106-
base::bit_cast<const Bytef*>(input.data()),
104+
reinterpret_cast<Bytef*>(const_cast<uint8_t*>(output.data())),
105+
&uncompressed_size,reinterpret_cast<const Bytef*>(input.data()),
107106
static_cast<uLongf>(input.size())) == Z_OK;
108107
}
109108

@@ -117,8 +116,8 @@ bool GzipUncompress(base::span<const uint8_t> input, std::string* output) {
117116
uLongf uncompressed_size =GetUncompressedSize(input);
118117
output->resize(uncompressed_size);
119118
returnzlib_internal::GzipUncompressHelper(
120-
base::bit_cast<Bytef*>(output->data()), &uncompressed_size,
121-
base::bit_cast<const Bytef*>(input.data()),
119+
reinterpret_cast<Bytef*>(output->data()), &uncompressed_size,
120+
reinterpret_cast<const Bytef*>(input.data()),
122121
static_cast<uLongf>(input.size())) == Z_OK;
123122
}
124123

@@ -128,7 +127,8 @@ uint32_t GetUncompressedSize(base::span<const char> compressed_data) {
128127

129128
uint32_tGetUncompressedSize(base::span<constuint8_t> compressed_data) {
130129
returnzlib_internal::GetGzipUncompressedSize(
131-
base::bit_cast<Bytef*>(compressed_data.data()), compressed_data.size());
130+
reinterpret_cast<const Bytef*>(compressed_data.data()),
131+
compressed_data.size());
132132
}
133133

134134
}// namespace compression

‎deps/zlib/trees.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,8 @@ local void compress_block(deflate_state *s, const ct_data *ltree,
938938

939939
/* Check for no overlay of pending_buf on needed symbols */
940940
#ifdefLIT_MEM
941-
Assert(s->pending< (s->lit_bufsize <<1)+sx,"pendingBuf overflow");
941+
Assert(s->pending< (s->lit_bufsize <<1)+ (sx <<1),
942+
"pendingBuf overflow");
942943
#else
943944
Assert(s->pending<s->lit_bufsize+sx,"pendingBuf overflow");
944945
#endif

‎doc/contributing/maintaining/maintaining-dependencies.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This a list of all the dependencies:
3030
*[uv][]
3131
*[uvwasi 0.0.19][]
3232
*[V8][]
33-
*[zlib 1.3.0.1-motley-dd5fc13][]
33+
*[zlib][]
3434

3535
Any code which meets one or more of these conditions should
3636
be managed as a dependency:
@@ -304,7 +304,7 @@ See [maintaining-web-assembly][] for more informations.
304304
high-performance JavaScript and WebAssembly engine, written in C++.
305305
See[maintaining-V8][] for more informations.
306306

307-
###zlib 1.3.0.1-motley-dd5fc13
307+
###zlib
308308

309309
The[zlib](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/zlib)
310310
dependency lossless data-compression library,
@@ -341,4 +341,4 @@ performance improvements not currently available in standard zlib.
341341
[uv]:#uv
342342
[uvwasi 0.0.19]:#uvwasi-0019
343343
[v8]:#v8
344-
[zlib 1.3.0.1-motley-dd5fc13]:#zlib-1301-motley-dd5fc13
344+
[zlib]:#zlib

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp