rugged 0.26.3 → 0.26.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/winhttp/winhttp.h +6 -4
- data/vendor/libgit2/deps/zlib/adler32.c +14 -7
- data/vendor/libgit2/deps/zlib/crc32.c +29 -12
- data/vendor/libgit2/deps/zlib/deflate.c +499 -303
- data/vendor/libgit2/deps/zlib/deflate.h +18 -15
- data/vendor/libgit2/deps/zlib/gzguts.h +218 -0
- data/vendor/libgit2/deps/zlib/infback.c +2 -2
- data/vendor/libgit2/deps/zlib/inffast.c +34 -51
- data/vendor/libgit2/deps/zlib/inflate.c +86 -37
- data/vendor/libgit2/deps/zlib/inflate.h +7 -4
- data/vendor/libgit2/deps/zlib/inftrees.c +12 -14
- data/vendor/libgit2/deps/zlib/trees.c +38 -61
- data/vendor/libgit2/deps/zlib/zconf.h +499 -23
- data/vendor/libgit2/deps/zlib/zlib.h +298 -154
- data/vendor/libgit2/deps/zlib/zutil.c +27 -23
- data/vendor/libgit2/deps/zlib/zutil.h +35 -17
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +5 -4
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/checkout.c +34 -11
- data/vendor/libgit2/src/curl_stream.c +21 -0
- data/vendor/libgit2/src/curl_stream.h +1 -0
- data/vendor/libgit2/src/delta.c +30 -28
- data/vendor/libgit2/src/diff.c +0 -7
- data/vendor/libgit2/src/diff_file.c +3 -1
- data/vendor/libgit2/src/diff_generate.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +3 -1
- data/vendor/libgit2/src/global.c +4 -2
- data/vendor/libgit2/src/hash/hash_openssl.h +18 -3
- data/vendor/libgit2/src/ignore.c +60 -36
- data/vendor/libgit2/src/index.c +59 -26
- data/vendor/libgit2/src/indexer.c +15 -2
- data/vendor/libgit2/src/merge.c +18 -8
- data/vendor/libgit2/src/odb_mempack.c +1 -0
- data/vendor/libgit2/src/oidarray.c +12 -0
- data/vendor/libgit2/src/oidarray.h +1 -0
- data/vendor/libgit2/src/openssl_stream.c +17 -4
- data/vendor/libgit2/src/pack.c +10 -7
- data/vendor/libgit2/src/path.c +180 -22
- data/vendor/libgit2/src/path.h +73 -0
- data/vendor/libgit2/src/posix.c +1 -1
- data/vendor/libgit2/src/posix.h +3 -0
- data/vendor/libgit2/src/proxy.c +6 -0
- data/vendor/libgit2/src/proxy.h +1 -0
- data/vendor/libgit2/src/push.c +3 -0
- data/vendor/libgit2/src/refdb_fs.c +2 -2
- data/vendor/libgit2/src/refs.c +7 -1
- data/vendor/libgit2/src/repository.c +9 -3
- data/vendor/libgit2/src/sha1_lookup.c +2 -2
- data/vendor/libgit2/src/signature.c +1 -0
- data/vendor/libgit2/src/socket_stream.c +1 -1
- data/vendor/libgit2/src/stransport_stream.c +3 -1
- data/vendor/libgit2/src/submodule.c +54 -7
- data/vendor/libgit2/src/submodule.h +13 -0
- data/vendor/libgit2/src/transports/smart_pkt.c +8 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +6 -6
- data/vendor/libgit2/src/transports/winhttp.c +22 -0
- data/vendor/libgit2/src/tree.c +1 -1
- metadata +3 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/* inflate.c -- zlib decompression
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2016 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -92,6 +92,7 @@
|
|
92
92
|
#endif
|
93
93
|
|
94
94
|
/* function prototypes */
|
95
|
+
local int inflateStateCheck OF((z_streamp strm));
|
95
96
|
local void fixedtables OF((struct inflate_state FAR *state));
|
96
97
|
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
97
98
|
unsigned copy));
|
@@ -101,12 +102,26 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
|
101
102
|
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
|
102
103
|
unsigned len));
|
103
104
|
|
105
|
+
local int inflateStateCheck(strm)
|
106
|
+
z_streamp strm;
|
107
|
+
{
|
108
|
+
struct inflate_state FAR *state;
|
109
|
+
if (strm == Z_NULL ||
|
110
|
+
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
111
|
+
return 1;
|
112
|
+
state = (struct inflate_state FAR *)strm->state;
|
113
|
+
if (state == Z_NULL || state->strm != strm ||
|
114
|
+
state->mode < HEAD || state->mode > SYNC)
|
115
|
+
return 1;
|
116
|
+
return 0;
|
117
|
+
}
|
118
|
+
|
104
119
|
int ZEXPORT inflateResetKeep(strm)
|
105
120
|
z_streamp strm;
|
106
121
|
{
|
107
122
|
struct inflate_state FAR *state;
|
108
123
|
|
109
|
-
if (strm
|
124
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
110
125
|
state = (struct inflate_state FAR *)strm->state;
|
111
126
|
strm->total_in = strm->total_out = state->total = 0;
|
112
127
|
strm->msg = Z_NULL;
|
@@ -131,7 +146,7 @@ z_streamp strm;
|
|
131
146
|
{
|
132
147
|
struct inflate_state FAR *state;
|
133
148
|
|
134
|
-
if (strm
|
149
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
135
150
|
state = (struct inflate_state FAR *)strm->state;
|
136
151
|
state->wsize = 0;
|
137
152
|
state->whave = 0;
|
@@ -147,7 +162,7 @@ int windowBits;
|
|
147
162
|
struct inflate_state FAR *state;
|
148
163
|
|
149
164
|
/* get the state */
|
150
|
-
if (strm
|
165
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
151
166
|
state = (struct inflate_state FAR *)strm->state;
|
152
167
|
|
153
168
|
/* extract wrap request from windowBits parameter */
|
@@ -156,7 +171,7 @@ int windowBits;
|
|
156
171
|
windowBits = -windowBits;
|
157
172
|
}
|
158
173
|
else {
|
159
|
-
wrap = (windowBits >> 4) +
|
174
|
+
wrap = (windowBits >> 4) + 5;
|
160
175
|
#ifdef GUNZIP
|
161
176
|
if (windowBits < 48)
|
162
177
|
windowBits &= 15;
|
@@ -210,7 +225,9 @@ int stream_size;
|
|
210
225
|
if (state == Z_NULL) return Z_MEM_ERROR;
|
211
226
|
Tracev((stderr, "inflate: allocated\n"));
|
212
227
|
strm->state = (struct internal_state FAR *)state;
|
228
|
+
state->strm = strm;
|
213
229
|
state->window = Z_NULL;
|
230
|
+
state->mode = HEAD; /* to pass state test in inflateReset2() */
|
214
231
|
ret = inflateReset2(strm, windowBits);
|
215
232
|
if (ret != Z_OK) {
|
216
233
|
ZFREE(strm, state);
|
@@ -234,17 +251,17 @@ int value;
|
|
234
251
|
{
|
235
252
|
struct inflate_state FAR *state;
|
236
253
|
|
237
|
-
if (strm
|
254
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
238
255
|
state = (struct inflate_state FAR *)strm->state;
|
239
256
|
if (bits < 0) {
|
240
257
|
state->hold = 0;
|
241
258
|
state->bits = 0;
|
242
259
|
return Z_OK;
|
243
260
|
}
|
244
|
-
if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
|
261
|
+
if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR;
|
245
262
|
value &= (1L << bits) - 1;
|
246
|
-
state->hold += value << state->bits;
|
247
|
-
state->bits += bits;
|
263
|
+
state->hold += (unsigned)value << state->bits;
|
264
|
+
state->bits += (uInt)bits;
|
248
265
|
return Z_OK;
|
249
266
|
}
|
250
267
|
|
@@ -625,7 +642,7 @@ int flush;
|
|
625
642
|
static const unsigned short order[19] = /* permutation of code lengths */
|
626
643
|
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
|
627
644
|
|
628
|
-
if (strm
|
645
|
+
if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
|
629
646
|
(strm->next_in == Z_NULL && strm->avail_in != 0))
|
630
647
|
return Z_STREAM_ERROR;
|
631
648
|
|
@@ -645,6 +662,8 @@ int flush;
|
|
645
662
|
NEEDBITS(16);
|
646
663
|
#ifdef GUNZIP
|
647
664
|
if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
|
665
|
+
if (state->wbits == 0)
|
666
|
+
state->wbits = 15;
|
648
667
|
state->check = crc32(0L, Z_NULL, 0);
|
649
668
|
CRC2(state->check, hold);
|
650
669
|
INITBITS();
|
@@ -672,7 +691,7 @@ int flush;
|
|
672
691
|
len = BITS(4) + 8;
|
673
692
|
if (state->wbits == 0)
|
674
693
|
state->wbits = len;
|
675
|
-
|
694
|
+
if (len > 15 || len > state->wbits) {
|
676
695
|
strm->msg = (char *)"invalid window size";
|
677
696
|
state->mode = BAD;
|
678
697
|
break;
|
@@ -699,14 +718,16 @@ int flush;
|
|
699
718
|
}
|
700
719
|
if (state->head != Z_NULL)
|
701
720
|
state->head->text = (int)((hold >> 8) & 1);
|
702
|
-
if (state->flags & 0x0200)
|
721
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
722
|
+
CRC2(state->check, hold);
|
703
723
|
INITBITS();
|
704
724
|
state->mode = TIME;
|
705
725
|
case TIME:
|
706
726
|
NEEDBITS(32);
|
707
727
|
if (state->head != Z_NULL)
|
708
728
|
state->head->time = hold;
|
709
|
-
if (state->flags & 0x0200)
|
729
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
730
|
+
CRC4(state->check, hold);
|
710
731
|
INITBITS();
|
711
732
|
state->mode = OS;
|
712
733
|
case OS:
|
@@ -715,7 +736,8 @@ int flush;
|
|
715
736
|
state->head->xflags = (int)(hold & 0xff);
|
716
737
|
state->head->os = (int)(hold >> 8);
|
717
738
|
}
|
718
|
-
if (state->flags & 0x0200)
|
739
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
740
|
+
CRC2(state->check, hold);
|
719
741
|
INITBITS();
|
720
742
|
state->mode = EXLEN;
|
721
743
|
case EXLEN:
|
@@ -724,7 +746,8 @@ int flush;
|
|
724
746
|
state->length = (unsigned)(hold);
|
725
747
|
if (state->head != Z_NULL)
|
726
748
|
state->head->extra_len = (unsigned)hold;
|
727
|
-
if (state->flags & 0x0200)
|
749
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
750
|
+
CRC2(state->check, hold);
|
728
751
|
INITBITS();
|
729
752
|
}
|
730
753
|
else if (state->head != Z_NULL)
|
@@ -742,7 +765,7 @@ int flush;
|
|
742
765
|
len + copy > state->head->extra_max ?
|
743
766
|
state->head->extra_max - len : copy);
|
744
767
|
}
|
745
|
-
if (state->flags & 0x0200)
|
768
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
746
769
|
state->check = crc32(state->check, next, copy);
|
747
770
|
have -= copy;
|
748
771
|
next += copy;
|
@@ -761,9 +784,9 @@ int flush;
|
|
761
784
|
if (state->head != Z_NULL &&
|
762
785
|
state->head->name != Z_NULL &&
|
763
786
|
state->length < state->head->name_max)
|
764
|
-
state->head->name[state->length++] = len;
|
787
|
+
state->head->name[state->length++] = (Bytef)len;
|
765
788
|
} while (len && copy < have);
|
766
|
-
if (state->flags & 0x0200)
|
789
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
767
790
|
state->check = crc32(state->check, next, copy);
|
768
791
|
have -= copy;
|
769
792
|
next += copy;
|
@@ -782,9 +805,9 @@ int flush;
|
|
782
805
|
if (state->head != Z_NULL &&
|
783
806
|
state->head->comment != Z_NULL &&
|
784
807
|
state->length < state->head->comm_max)
|
785
|
-
state->head->comment[state->length++] = len;
|
808
|
+
state->head->comment[state->length++] = (Bytef)len;
|
786
809
|
} while (len && copy < have);
|
787
|
-
if (state->flags & 0x0200)
|
810
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
788
811
|
state->check = crc32(state->check, next, copy);
|
789
812
|
have -= copy;
|
790
813
|
next += copy;
|
@@ -796,7 +819,7 @@ int flush;
|
|
796
819
|
case HCRC:
|
797
820
|
if (state->flags & 0x0200) {
|
798
821
|
NEEDBITS(16);
|
799
|
-
if (hold != (state->check & 0xffff)) {
|
822
|
+
if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
|
800
823
|
strm->msg = (char *)"header crc mismatch";
|
801
824
|
state->mode = BAD;
|
802
825
|
break;
|
@@ -1177,11 +1200,11 @@ int flush;
|
|
1177
1200
|
out -= left;
|
1178
1201
|
strm->total_out += out;
|
1179
1202
|
state->total += out;
|
1180
|
-
if (out)
|
1203
|
+
if ((state->wrap & 4) && out)
|
1181
1204
|
strm->adler = state->check =
|
1182
1205
|
UPDATE(state->check, put - out, out);
|
1183
1206
|
out = left;
|
1184
|
-
if ((
|
1207
|
+
if ((state->wrap & 4) && (
|
1185
1208
|
#ifdef GUNZIP
|
1186
1209
|
state->flags ? hold :
|
1187
1210
|
#endif
|
@@ -1240,10 +1263,10 @@ int flush;
|
|
1240
1263
|
strm->total_in += in;
|
1241
1264
|
strm->total_out += out;
|
1242
1265
|
state->total += out;
|
1243
|
-
if (state->wrap && out)
|
1266
|
+
if ((state->wrap & 4) && out)
|
1244
1267
|
strm->adler = state->check =
|
1245
1268
|
UPDATE(state->check, strm->next_out - out, out);
|
1246
|
-
strm->data_type = state->bits + (state->last ? 64 : 0) +
|
1269
|
+
strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
|
1247
1270
|
(state->mode == TYPE ? 128 : 0) +
|
1248
1271
|
(state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
|
1249
1272
|
if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
|
@@ -1255,7 +1278,7 @@ int ZEXPORT inflateEnd(strm)
|
|
1255
1278
|
z_streamp strm;
|
1256
1279
|
{
|
1257
1280
|
struct inflate_state FAR *state;
|
1258
|
-
if (strm
|
1281
|
+
if (inflateStateCheck(strm))
|
1259
1282
|
return Z_STREAM_ERROR;
|
1260
1283
|
state = (struct inflate_state FAR *)strm->state;
|
1261
1284
|
if (state->window != Z_NULL) ZFREE(strm, state->window);
|
@@ -1273,7 +1296,7 @@ uInt *dictLength;
|
|
1273
1296
|
struct inflate_state FAR *state;
|
1274
1297
|
|
1275
1298
|
/* check state */
|
1276
|
-
if (strm
|
1299
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1277
1300
|
state = (struct inflate_state FAR *)strm->state;
|
1278
1301
|
|
1279
1302
|
/* copy dictionary */
|
@@ -1298,7 +1321,7 @@ uInt dictLength;
|
|
1298
1321
|
int ret;
|
1299
1322
|
|
1300
1323
|
/* check state */
|
1301
|
-
if (strm
|
1324
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1302
1325
|
state = (struct inflate_state FAR *)strm->state;
|
1303
1326
|
if (state->wrap != 0 && state->mode != DICT)
|
1304
1327
|
return Z_STREAM_ERROR;
|
@@ -1330,7 +1353,7 @@ gz_headerp head;
|
|
1330
1353
|
struct inflate_state FAR *state;
|
1331
1354
|
|
1332
1355
|
/* check state */
|
1333
|
-
if (strm
|
1356
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1334
1357
|
state = (struct inflate_state FAR *)strm->state;
|
1335
1358
|
if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
|
1336
1359
|
|
@@ -1383,7 +1406,7 @@ z_streamp strm;
|
|
1383
1406
|
struct inflate_state FAR *state;
|
1384
1407
|
|
1385
1408
|
/* check parameters */
|
1386
|
-
if (strm
|
1409
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1387
1410
|
state = (struct inflate_state FAR *)strm->state;
|
1388
1411
|
if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
|
1389
1412
|
|
@@ -1430,7 +1453,7 @@ z_streamp strm;
|
|
1430
1453
|
{
|
1431
1454
|
struct inflate_state FAR *state;
|
1432
1455
|
|
1433
|
-
if (strm
|
1456
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1434
1457
|
state = (struct inflate_state FAR *)strm->state;
|
1435
1458
|
return state->mode == STORED && state->bits == 0;
|
1436
1459
|
}
|
@@ -1445,8 +1468,7 @@ z_streamp source;
|
|
1445
1468
|
unsigned wsize;
|
1446
1469
|
|
1447
1470
|
/* check input */
|
1448
|
-
if (
|
1449
|
-
source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
|
1471
|
+
if (inflateStateCheck(source) || dest == Z_NULL)
|
1450
1472
|
return Z_STREAM_ERROR;
|
1451
1473
|
state = (struct inflate_state FAR *)source->state;
|
1452
1474
|
|
@@ -1467,6 +1489,7 @@ z_streamp source;
|
|
1467
1489
|
/* copy state */
|
1468
1490
|
zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
|
1469
1491
|
zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
|
1492
|
+
copy->strm = dest;
|
1470
1493
|
if (state->lencode >= state->codes &&
|
1471
1494
|
state->lencode <= state->codes + ENOUGH - 1) {
|
1472
1495
|
copy->lencode = copy->codes + (state->lencode - state->codes);
|
@@ -1488,25 +1511,51 @@ int subvert;
|
|
1488
1511
|
{
|
1489
1512
|
struct inflate_state FAR *state;
|
1490
1513
|
|
1491
|
-
if (strm
|
1514
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1492
1515
|
state = (struct inflate_state FAR *)strm->state;
|
1493
|
-
state->sane = !subvert;
|
1494
1516
|
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
1517
|
+
state->sane = !subvert;
|
1495
1518
|
return Z_OK;
|
1496
1519
|
#else
|
1520
|
+
(void)subvert;
|
1497
1521
|
state->sane = 1;
|
1498
1522
|
return Z_DATA_ERROR;
|
1499
1523
|
#endif
|
1500
1524
|
}
|
1501
1525
|
|
1526
|
+
int ZEXPORT inflateValidate(strm, check)
|
1527
|
+
z_streamp strm;
|
1528
|
+
int check;
|
1529
|
+
{
|
1530
|
+
struct inflate_state FAR *state;
|
1531
|
+
|
1532
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1533
|
+
state = (struct inflate_state FAR *)strm->state;
|
1534
|
+
if (check)
|
1535
|
+
state->wrap |= 4;
|
1536
|
+
else
|
1537
|
+
state->wrap &= ~4;
|
1538
|
+
return Z_OK;
|
1539
|
+
}
|
1540
|
+
|
1502
1541
|
long ZEXPORT inflateMark(strm)
|
1503
1542
|
z_streamp strm;
|
1504
1543
|
{
|
1505
1544
|
struct inflate_state FAR *state;
|
1506
1545
|
|
1507
|
-
if (strm
|
1546
|
+
if (inflateStateCheck(strm))
|
1547
|
+
return -(1L << 16);
|
1508
1548
|
state = (struct inflate_state FAR *)strm->state;
|
1509
|
-
return ((long)(state->back) << 16) +
|
1549
|
+
return (long)(((unsigned long)((long)state->back)) << 16) +
|
1510
1550
|
(state->mode == COPY ? state->length :
|
1511
1551
|
(state->mode == MATCH ? state->was - state->length : 0));
|
1512
1552
|
}
|
1553
|
+
|
1554
|
+
unsigned long ZEXPORT inflateCodesUsed(strm)
|
1555
|
+
z_streamp strm;
|
1556
|
+
{
|
1557
|
+
struct inflate_state FAR *state;
|
1558
|
+
if (inflateStateCheck(strm)) return (unsigned long)-1;
|
1559
|
+
state = (struct inflate_state FAR *)strm->state;
|
1560
|
+
return (unsigned long)(state->next - state->codes);
|
1561
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* inflate.h -- internal inflate state definition
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2016 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
/* Possible inflate modes between inflate() calls */
|
20
20
|
typedef enum {
|
21
|
-
HEAD,
|
21
|
+
HEAD = 16180, /* i: waiting for magic header */
|
22
22
|
FLAGS, /* i: waiting for method and flags (gzip) */
|
23
23
|
TIME, /* i: waiting for modification time (gzip) */
|
24
24
|
OS, /* i: waiting for extra flags and operating system (gzip) */
|
@@ -77,11 +77,14 @@ typedef enum {
|
|
77
77
|
CHECK -> LENGTH -> DONE
|
78
78
|
*/
|
79
79
|
|
80
|
-
/*
|
80
|
+
/* State maintained between inflate() calls -- approximately 7K bytes, not
|
81
|
+
including the allocated sliding window, which is up to 32K bytes. */
|
81
82
|
struct inflate_state {
|
83
|
+
z_streamp strm; /* pointer back to this zlib stream */
|
82
84
|
inflate_mode mode; /* current inflate mode */
|
83
85
|
int last; /* true if processing last block */
|
84
|
-
int wrap; /* bit 0 true for zlib, bit 1 true for gzip
|
86
|
+
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
|
87
|
+
bit 2 true to validate check value */
|
85
88
|
int havedict; /* true if dictionary provided */
|
86
89
|
int flags; /* gzip header method and flags (0 if zlib) */
|
87
90
|
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* inftrees.c -- generate Huffman trees for efficient decoding
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2017 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#define MAXBITS 15
|
10
10
|
|
11
11
|
const char inflate_copyright[] =
|
12
|
-
" inflate 1.2.
|
12
|
+
" inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
|
13
13
|
/*
|
14
14
|
If you use the zlib library in a product, an acknowledgment is welcome
|
15
15
|
in the documentation of your product. If for some reason you cannot
|
@@ -54,7 +54,7 @@ unsigned short FAR *work;
|
|
54
54
|
code FAR *next; /* next available space in table */
|
55
55
|
const unsigned short FAR *base; /* base value table to use */
|
56
56
|
const unsigned short FAR *extra; /* extra bits table to use */
|
57
|
-
|
57
|
+
unsigned match; /* use base and extra for symbol >= match */
|
58
58
|
unsigned short count[MAXBITS+1]; /* number of codes of each length */
|
59
59
|
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
|
60
60
|
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
|
@@ -62,7 +62,7 @@ unsigned short FAR *work;
|
|
62
62
|
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
63
63
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
64
64
|
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
65
|
-
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16,
|
65
|
+
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
|
66
66
|
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
67
67
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
68
68
|
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
@@ -181,19 +181,17 @@ unsigned short FAR *work;
|
|
181
181
|
switch (type) {
|
182
182
|
case CODES:
|
183
183
|
base = extra = work; /* dummy value--not used */
|
184
|
-
|
184
|
+
match = 20;
|
185
185
|
break;
|
186
186
|
case LENS:
|
187
187
|
base = lbase;
|
188
|
-
base -= 257;
|
189
188
|
extra = lext;
|
190
|
-
|
191
|
-
end = 256;
|
189
|
+
match = 257;
|
192
190
|
break;
|
193
|
-
default:
|
191
|
+
default: /* DISTS */
|
194
192
|
base = dbase;
|
195
193
|
extra = dext;
|
196
|
-
|
194
|
+
match = 0;
|
197
195
|
}
|
198
196
|
|
199
197
|
/* initialize state for loop */
|
@@ -216,13 +214,13 @@ unsigned short FAR *work;
|
|
216
214
|
for (;;) {
|
217
215
|
/* create table entry */
|
218
216
|
here.bits = (unsigned char)(len - drop);
|
219
|
-
if (
|
217
|
+
if (work[sym] + 1U < match) {
|
220
218
|
here.op = (unsigned char)0;
|
221
219
|
here.val = work[sym];
|
222
220
|
}
|
223
|
-
else if (
|
224
|
-
here.op = (unsigned char)(extra[work[sym]]);
|
225
|
-
here.val = base[work[sym]];
|
221
|
+
else if (work[sym] >= match) {
|
222
|
+
here.op = (unsigned char)(extra[work[sym] - match]);
|
223
|
+
here.val = base[work[sym] - match];
|
226
224
|
}
|
227
225
|
else {
|
228
226
|
here.op = (unsigned char)(32 + 64); /* end of block */
|