GeezerVison is showing github.com — deps: update zlib to 1.3.2.1-motley-456ae73 · nodejs/node@7dd8815
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/BUILD.gn -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -375,8 +375,6 @@ component("zlib") { | 375 | 375 | # Must be after no_chromium_code for warning flags to be ordered correctly. | 376 | 376 | ":zlib_warnings", | 377 | 377 | ] | 378 | | - | 379 | | - allow_circular_includes_from = deps | 380 | 378 | } | 381 | 379 |
| 382 | 380 | config("minizip_warnings") { | |
Collapse file Copy file name to clipboardExpand all lines: deps/zlib/contrib/optimizations/inffast_chunk.c +25-10Lines changed: 25 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -132,28 +132,35 @@ void ZLIB_INTERNAL inflate_fast_chunk_(z_streamp strm, unsigned start) { | 132 | 132 | } while (0) | 133 | 133 | #endif | 134 | 134 |
| | 135 | +#ifdef INFLATE_CHUNK_READ_64LE | | 136 | + REFILL(); | | 137 | +#endif | | 138 | + | 135 | 139 | /* decode literals and length/distances until end-of-block or not enough | 136 | 140 | input data or output space */ | 137 | 141 | do { | 138 | | -#ifdef INFLATE_CHUNK_READ_64LE | 139 | | - REFILL(); | 140 | | -#else | | 142 | +#ifndef INFLATE_CHUNK_READ_64LE | 141 | 143 | if (bits < 15) { | 142 | 144 | hold += (unsigned long)(*in++) << bits; | 143 | 145 | bits += 8; | 144 | 146 | hold += (unsigned long)(*in++) << bits; | 145 | 147 | bits += 8; | 146 | 148 | } | 147 | 149 | #endif | | 150 | + /* Worst case: previous iteration had 3 literals (56 - 20 (lits) - 15 (lit) = 21 bits) | | 151 | + or a match (56 - 15 (dist) - 13 (extra) = 28 bits), leaving bits >= lenbits (<= 10). */ | | 152 | + Assert(bits >= state->lenbits, "inflate_fast: short lit/len index"); | 148 | 153 | here = lcode + (hold & lmask); | 149 | 154 | #ifdef INFLATE_CHUNK_READ_64LE | 150 | | - if (here->op == 0) { /* literal */ | | 155 | + REFILL(); | | 156 | + if (here->op == 0) { /* literal */ | 151 | 157 | Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ? | 152 | 158 | "inflate: literal '%c'\n" : | 153 | 159 | "inflate: literal 0x%02x\n", here->val)); | 154 | 160 | *out++ = (unsigned char)(here->val); | 155 | 161 | hold >>= here->bits; | 156 | 162 | bits -= here->bits; | | 163 | + Assert(bits >= state->lenbits, "inflate_fast: short 2nd lit/len index"); | 157 | 164 | here = lcode + (hold & lmask); | 158 | 165 | if (here->op == 0) { /* literal */ | 159 | 166 | Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ? | @@ -162,6 +169,7 @@ void ZLIB_INTERNAL inflate_fast_chunk_(z_streamp strm, unsigned start) { | 162 | 169 | *out++ = (unsigned char)(here->val); | 163 | 170 | hold >>= here->bits; | 164 | 171 | bits -= here->bits; | | 172 | + Assert(bits >= state->lenbits, "inflate_fast: short 3rd lit/len index"); | 165 | 173 | here = lcode + (hold & lmask); | 166 | 174 | } | 167 | 175 | } | @@ -187,6 +195,7 @@ void ZLIB_INTERNAL inflate_fast_chunk_(z_streamp strm, unsigned start) { | 187 | 195 | bits += 8; | 188 | 196 | } | 189 | 197 | #endif | | 198 | + Assert(bits >= op, "inflate_fast: short length extra bits"); | 190 | 199 | len += (unsigned)hold & ((1U << op) - 1); | 191 | 200 | hold >>= op; | 192 | 201 | bits -= op; | @@ -200,7 +209,14 @@ void ZLIB_INTERNAL inflate_fast_chunk_(z_streamp strm, unsigned start) { | 200 | 209 | bits += 8; | 201 | 210 | } | 202 | 211 | #endif | | 212 | + /* Worst case: 56 - 20 (lits) - 15 (len) - 5 (extra) = 16 bits remain for distbits <= 9. */ | | 213 | + Assert(bits >= state->distbits, "inflate_fast: short dist index"); | 203 | 214 | here = dcode + (hold & dmask); | | 215 | +#ifdef INFLATE_CHUNK_READ_64LE | | 216 | + /* Refill after the table load so the two can overlap, and so the | | 217 | + distance code and its extra bits start from a full 56 bits. */ | | 218 | + REFILL(); | | 219 | +#endif | 204 | 220 | dodist: | 205 | 221 | op = (unsigned)(here->bits); | 206 | 222 | hold >>= op; | @@ -209,20 +225,17 @@ void ZLIB_INTERNAL inflate_fast_chunk_(z_streamp strm, unsigned start) { | 209 | 225 | if (op & 16) { /* distance base */ | 210 | 226 | dist = (unsigned)(here->val); | 211 | 227 | op &= 15; /* number of extra bits */ | 212 | | - /* we have two fast-path loads: 10+10 + 15+5 + 15 = 55, | 213 | | - but we may need to refill here in the worst case */ | | 228 | +#ifndef INFLATE_CHUNK_READ_64LE | 214 | 229 | if (bits < op) { | 215 | | -#ifdef INFLATE_CHUNK_READ_64LE | 216 | | - REFILL(); | 217 | | -#else | 218 | 230 | hold += (unsigned long)(*in++) << bits; | 219 | 231 | bits += 8; | 220 | 232 | if (bits < op) { | 221 | 233 | hold += (unsigned long)(*in++) << bits; | 222 | 234 | bits += 8; | 223 | 235 | } | 224 | | -#endif | 225 | 236 | } | | 237 | +#endif | | 238 | + Assert(bits >= op, "inflate_fast: short distance extra bits"); | 226 | 239 | dist += (unsigned)hold & ((1U << op) - 1); | 227 | 240 | #ifdef INFLATE_STRICT | 228 | 241 | if (dist > dmax) { | @@ -313,6 +326,7 @@ void ZLIB_INTERNAL inflate_fast_chunk_(z_streamp strm, unsigned start) { | 313 | 326 | } | 314 | 327 | } | 315 | 328 | else if ((op & 64) == 0) { /* 2nd level distance code */ | | 329 | + Assert(bits >= op, "inflate_fast: short 2nd level dist index"); | 316 | 330 | here = dcode + here->val + (hold & ((1U << op) - 1)); | 317 | 331 | goto dodist; | 318 | 332 | } | @@ -323,6 +337,7 @@ void ZLIB_INTERNAL inflate_fast_chunk_(z_streamp strm, unsigned start) { | 323 | 337 | } | 324 | 338 | } | 325 | 339 | else if ((op & 64) == 0) { /* 2nd level length code */ | | 340 | + Assert(bits >= op, "inflate_fast: short 2nd level lit/len index"); | 326 | 341 | here = lcode + here->val + (hold & ((1U << op) - 1)); | 327 | 342 | goto dolen; | 328 | 343 | } | |
Collapse file Copy file name to clipboardExpand all lines: deps/zlib/contrib/tests/utils_unittest.cc +50Lines changed: 50 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1248,6 +1248,55 @@ TEST(ZlibTest, InflateCopySIGILLReproduction) { | 1248 | 1248 | } | 1249 | 1249 | } | 1250 | 1250 |
| | 1251 | +TEST(ZlibTest, InflateChunkRefillDistanceBitBudget) { | | 1252 | + // Tests the edge case where one fast-loop iteration uses 10 + 10 + 15 + 5 + | | 1253 | + // 15 = 55 of the 56 bits a refill. There should be sufficient bits for the | | 1254 | + // next iteration. | | 1255 | + static const uint8_t kCompressed[] = { | | 1256 | + 0xcd, 0xef, 0x01, 0x82, 0x24, 0x49, 0x92, 0x24, 0x49, 0x22, 0xb1, 0xa8, | | 1257 | + 0x79, 0xf5, 0xec, 0x2f, 0x33, 0xf3, 0x17, 0xf7, 0x7a, 0xf8, 0xc6, 0x1d, | | 1258 | + 0x20, 0xb1, 0xa8, 0x79, 0x64, 0xf5, 0xec, 0xfd, 0xf3, 0xef, 0xff, 0x1f, | | 1259 | + 0xfc, 0xff, 0xfe, 0xfd, 0xe7, 0xdf, 0xff, 0x3f, 0xf8, 0xff, 0xfd, 0xfb, | | 1260 | + 0xcf, 0xbf, 0xff, 0x7f, 0xf0, 0xff, 0xfb, 0x17}; | | 1261 | + std::vector<uint8_t> output(402 + 512); | | 1262 | + z_stream stream = {}; | | 1263 | + stream.next_in = const_cast<uint8_t*>(kCompressed); | | 1264 | + stream.avail_in = sizeof(kCompressed); | | 1265 | + stream.next_out = output.data(); | | 1266 | + stream.avail_out = output.size(); | | 1267 | + | | 1268 | + ASSERT_EQ(Z_OK, inflateInit2(&stream, -MAX_WBITS)); | | 1269 | + EXPECT_EQ(Z_STREAM_END, inflate(&stream, Z_FINISH)); | | 1270 | + EXPECT_EQ(402u, stream.total_out); | | 1271 | + EXPECT_EQ(Z_OK, inflateEnd(&stream)); | | 1272 | + EXPECT_EQ('b', output[133]); // Decodes as 'a' if the refill is not reached. | | 1273 | +} | | 1274 | + | | 1275 | +TEST(ZlibTest, InflateChunkRefillLiteralBitBudget) { | | 1276 | + // Test an edge case where an iteration ends at a literal. and returns to the | | 1277 | + // top of the inflate loop. | | 1278 | + static const uint8_t kCompressed[] = { | | 1279 | + 0x05, 0xe0, 0x81, 0x81, 0x04, 0x49, 0x92, 0x24, 0x49, 0xb2, 0xa8, 0x79, | | 1280 | + 0x64, 0xcf, 0x1e, 0x96, 0x55, 0x05, 0xc5, 0x3f, 0xf4, 0x44, 0xff, 0xfe, | | 1281 | + 0xf7, 0xcf, 0x3f, 0xff, 0xbf, 0x7f, 0xff, 0xfb, 0xe7, 0x9f, 0xff, 0xdf, | | 1282 | + 0xbf, 0xff, 0xfd, 0xf3, 0xcf, 0xff, 0xef, 0xdf, 0xff, 0xfe, 0xf9, 0xe7, | | 1283 | + 0xff, 0xf7, 0xef, 0x7f, 0xff, 0xfc, 0xf3, 0xff, 0xfb, 0xf7, 0xbf, 0x7f, | | 1284 | + 0xfe, 0xf9, 0xff, 0x01}; | | 1285 | + std::vector<uint8_t> output(30 + 512); | | 1286 | + z_stream stream = {}; | | 1287 | + stream.next_in = const_cast<uint8_t*>(kCompressed); | | 1288 | + stream.avail_in = sizeof(kCompressed); | | 1289 | + stream.next_out = output.data(); | | 1290 | + stream.avail_out = output.size(); | | 1291 | + | | 1292 | + ASSERT_EQ(Z_OK, inflateInit2(&stream, -MAX_WBITS)); | | 1293 | + EXPECT_EQ(Z_STREAM_END, inflate(&stream, Z_FINISH)); | | 1294 | + EXPECT_EQ(30u, stream.total_out); | | 1295 | + EXPECT_EQ(Z_OK, inflateEnd(&stream)); | | 1296 | + // Decodes as 'a' if the accumulator runs short before the next lookup. | | 1297 | + EXPECT_EQ('b', output[5]); | | 1298 | +} | | 1299 | + | 1251 | 1300 | // TODO(gustavoa): make these tests run standalone. | 1252 | 1301 | #ifndef CMAKE_STANDALONE_UNITTESTS | 1253 | 1302 |
| @@ -1513,3 +1562,4 @@ TEST(ZlibTest, Compare256ReachesMaxMatch) { | 1513 | 1562 | } | 1514 | 1563 |
| 1515 | 1564 | #endif | | 1565 | + |
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.3.2.1-motley-285e94b" | | 5 | +#define ZLIB_VERSION "1.3.2.1-motley-456ae73" | 6 | 6 | #endif // SRC_ZLIB_VERSION_H_ |
|