clean useless fields in gzip header

master
nik 2014-04-17 20:44:19 -03:00
rodzic a4d7bdef8d
commit de4c26e3c8
3 zmienionych plików z 14 dodań i 10 usunięć

Wyświetl plik

@ -137,9 +137,6 @@ var Inflate = function(options) {
}
this.header = new gzheader();
this.header.name_max = 65536;
this.header.comm_max = 65536;
this.header.extra_max = 65536;
zlib_inflate.inflateGetHeader(this.strm, this.header);
};

Wyświetl plik

@ -14,16 +14,20 @@ function GZheader() {
this.extra = null;
/* extra field length (valid if extra != Z_NULL) */
this.extra_len = 0;
/* setup limits is not necessary because in js we should not preallocate memory */
/* for inflate use constant limit in 65536 bytes */
/* space at extra (only when reading header) */
this.extra_max = 0;
/*this.extra_max = 0;*/
/* pointer to zero-terminated file name or Z_NULL */
this.name = '';
/* space at name (only when reading header) */
this.name_max = 0;
/*this.name_max = 0;*/
/* pointer to zero-terminated comment or Z_NULL */
this.comment = '';
/* space at comment (only when reading header) */
this.comm_max = 0;
/*this.comm_max = 0;*/
/* true if there was or will be a header crc */
this.hcrc = 0;
/* true when done reading gzip header (not used when writing a gzip file) */

Wyświetl plik

@ -142,7 +142,6 @@ function InflateState() {
this.ndist = 0; /* number of distance code lengths */
this.have = 0; /* number of code lengths in lens[] */
this.next = null; /* next available space in codes[] */
this.next_index = 0;
//unsigned short array
//todo: test later with Uint16Array
@ -610,7 +609,9 @@ function inflate(strm, flush) {
state.head.extra,
input,
next,
len + copy > state.head.extra_max - len ? state.head.extra_max : copy,
/* use constant limit because of extra field limitation in 65536 bytes */
len + copy > 65536 - len ? 65536 : copy,
/*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
len
);
//zmemcpy(state.head.extra + len, next,
@ -636,8 +637,9 @@ function inflate(strm, flush) {
do {
// TODO: 2 or 1 bytes?
len = input[next + copy++];
/* use constant limit because in js we should not preallocate memory */
if (state.head && len &&
(state.length < state.head.name_max)) {
(state.length < 65536 /*state.head.name_max*/)) {
state.head.name += String.fromCharCode(len);
}
} while (len && copy < have);
@ -661,8 +663,9 @@ function inflate(strm, flush) {
copy = 0;
do {
len = input[next + copy++];
/* use constant limit because in js we should not preallocate memory */
if (state.head && len &&
(state.length < state.head.comm_max)) {
(state.length < 65536 /*state.head.comm_max*/)) {
state.head.comment += String.fromCharCode(len);
}
} while (len && copy < have);