Branch Coverage

deps/libgit2/deps/zlib/inflate.c
Criterion Covered Total %
branch 175 394 44.4


line true false branch
109 6396 0 if (strm == Z_NULL ||
6396 0 if (strm == Z_NULL ||
110 0 6396 strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
113 6396 0 if (state == Z_NULL || state->strm != strm ||
6396 0 if (state == Z_NULL || state->strm != strm ||
6396 0 if (state == Z_NULL || state->strm != strm ||
114 0 6396 state->mode < HEAD || state->mode > SYNC)
124 0 1190 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
128 1190 0 if (state->wrap) /* to support ill-conceived Java test suite */
149 0 1190 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
165 0 1190 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
169 0 1190 if (windowBits < 0) {
182 1190 0 if (windowBits && (windowBits < 8 || windowBits > 15))
1190 0 if (windowBits && (windowBits < 8 || windowBits > 15))
0 1190 if (windowBits && (windowBits < 8 || windowBits > 15))
184 0 1190 if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
0 0 if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
204 1190 0 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
1190 0 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
0 1190 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
207 0 1190 if (strm == Z_NULL) return Z_STREAM_ERROR;
209 1190 0 if (strm->zalloc == (alloc_func)0) {
217 1190 0 if (strm->zfree == (free_func)0)
225 0 1190 if (state == Z_NULL) return Z_MEM_ERROR;
232 0 1190 if (ret != Z_OK) {
254 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
256 0 0 if (bits < 0) {
261 0 0 if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR;
0 0 if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR;
407 562 446 if (state->window == Z_NULL) {
411 0 562 if (state->window == Z_NULL) return 1;
415 562 446 if (state->wsize == 0) {
422 0 1008 if (copy >= state->wsize) {
429 1008 0 if (dist > copy) dist = copy;
432 0 1008 if (copy) {
439 0 1008 if (state->wnext == state->wsize) state->wnext = 0;
440 1008 0 if (state->whave < state->wsize) state->whave += dist;
645 1636 0 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
1636 0 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
0 1636 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
646 0 0 (strm->next_in == Z_NULL && strm->avail_in != 0))
650 0 1636 if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
658 0 1190 if (state->wrap == 0) {
662 0 2380 NEEDBITS(16);
2380 1190 NEEDBITS(16);
678 0 1190 if (
685 0 1190 if (BITS(4) != Z_DEFLATED) {
692 0 1190 if (state->wbits == 0)
694 1190 0 if (len > 15 || len > state->wbits) {
0 1190 if (len > 15 || len > state->wbits) {
702 0 1190 state->mode = hold & 0x200 ? DICTID : TYPE;
838 0 0 NEEDBITS(32);
0 0 NEEDBITS(32);
843 0 0 if (state->havedict == 0) {
850 2264 0 if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
2264 0 if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
852 1074 1190 if (state->last) {
857 0 1190 NEEDBITS(3);
1190 1190 NEEDBITS(3);
871 0 771 if (flush == Z_TREES) {
889 0 0 NEEDBITS(32);
0 0 NEEDBITS(32);
890 0 0 if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
900 0 0 if (flush == Z_TREES) goto inf_leave;
905 0 0 if (copy) {
906 0 0 if (copy > have) copy = have;
907 0 0 if (copy > left) copy = left;
908 0 0 if (copy == 0) goto inf_leave;
921 0 838 NEEDBITS(14);
838 419 NEEDBITS(14);
929 419 0 if (state->nlen > 286 || state->ndist > 30) {
0 419 if (state->nlen > 286 || state->ndist > 30) {
939 6658 419 while (state->have < state->ncode) {
940 0 2476 NEEDBITS(3);
2476 6658 NEEDBITS(3);
944 1303 419 while (state->have < 19)
951 0 419 if (ret) {
960 30521 419 while (state->have < state->nlen + state->ndist) {
963 30521 11058 if ((unsigned)(here.bits) <= bits) break;
964 0 11058 PULLBYTE();
966 26233 4288 if (here.val < 16) {
971 307 3981 if (here.val == 16) {
972 0 68 NEEDBITS(here.bits + 2);
68 307 NEEDBITS(here.bits + 2);
974 0 307 if (state->have == 0) {
983 2350 1631 else if (here.val == 17) {
984 0 1203 NEEDBITS(here.bits + 3);
1203 2350 NEEDBITS(here.bits + 3);
991 0 1327 NEEDBITS(here.bits + 7);
1327 1631 NEEDBITS(here.bits + 7);
997 0 4288 if (state->have + copy > state->nlen + state->ndist) {
1002 95286 4288 while (copy--)
1008 0 419 if (state->mode == BAD) break;
1011 0 419 if (state->lens[256] == 0) {
1025 0 419 if (ret) {
1034 0 419 if (ret) {
1041 0 419 if (flush == Z_TREES) goto inf_leave;
1045 85024 1208 if (have >= 6 && left >= 258) {
91 84933 if (have >= 6 && left >= 258) {
1049 7 84 if (state->mode == TYPE)
1056 86141 65305 if ((unsigned)(here.bits) <= bits) break;
1057 0 65305 PULLBYTE();
1059 4262 81879 if (here.op && (here.op & 0xf0) == 0) {
0 4262 if (here.op && (here.op & 0xf0) == 0) {
1064 0 0 if ((unsigned)(last.bits + here.bits) <= bits) break;
1065 0 0 PULLBYTE();
1073 81879 4262 if ((int)(here.op) == 0) {
1080 1067 3195 if (here.op & 32) {
1086 0 3195 if (here.op & 64) {
1094 488 2707 if (state->extra) {
1095 0 127 NEEDBITS(state->extra);
127 488 NEEDBITS(state->extra);
1106 3195 1094 if ((unsigned)(here.bits) <= bits) break;
1107 0 1094 PULLBYTE();
1109 0 3195 if ((here.op & 0xf0) == 0) {
1114 0 0 if ((unsigned)(last.bits + here.bits) <= bits) break;
1115 0 0 PULLBYTE();
1122 0 3195 if (here.op & 64) {
1131 2451 744 if (state->extra) {
1132 0 1182 NEEDBITS(state->extra);
1182 2451 NEEDBITS(state->extra);
1147 56 3374 if (left == 0) goto inf_leave;
1149 803 2571 if (state->offset > copy) { /* copy from window */
1151 0 803 if (copy > state->whave) {
1152 0 0 if (state->sane) {
1171 0 803 if (copy > state->wnext) {
1177 580 223 if (copy > state->length) copy = state->length;
1183 56 3318 if (copy > left) copy = left;
1188 28140 3374 } while (--copy);
1189 3183 191 if (state->length == 0) state->mode = LEN;
1192 506 81775 if (left == 0) goto inf_leave;
1198 1074 0 if (state->wrap) {
1199 0 4296 NEEDBITS(32);
4296 1074 NEEDBITS(32);
1203 1074 0 if ((state->wrap & 4) && out)
1074 0 if ((state->wrap & 4) && out)
1207 1074 0 if ((state->wrap & 4) && (
0 1074 if ((state->wrap & 4) && (
1255 1190 446 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
562 628 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
562 0 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
0 562 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
1256 0 0 (state->mode < CHECK || flush != Z_FINISH)))
1257 0 1008 if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
1266 1636 0 if ((state->wrap & 4) && out)
562 1074 if ((state->wrap & 4) && out)
1269 1636 0 strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
1270 0 1636 (state->mode == TYPE ? 128 : 0) +
1271 1636 0 (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
0 1636 (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
1272 0 1636 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
0 0 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
1636 0 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
562 1074 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
1281 0 1190 if (inflateStateCheck(strm))
1284 562 628 if (state->window != Z_NULL) ZFREE(strm, state->window);
1299 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1303 0 0 if (state->whave && dictionary != Z_NULL) {
0 0 if (state->whave && dictionary != Z_NULL) {
1309 0 0 if (dictLength != Z_NULL)
1324 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1326 0 0 if (state->wrap != 0 && state->mode != DICT)
0 0 if (state->wrap != 0 && state->mode != DICT)
1330 0 0 if (state->mode == DICT) {
1333 0 0 if (dictid != state->check)
1340 0 0 if (ret) {
1356 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1358 0 0 if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
1387 0 0 while (next < len && got < 4) {
0 0 while (next < len && got < 4) {
1388 0 0 if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
0 0 if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
1390 0 0 else if (buf[next])
1409 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1411 0 0 if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
0 0 if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
1414 0 0 if (state->mode != SYNC) {
1419 0 0 while (state->bits >= 8) {
1435 0 0 if (state->have != 4) return Z_DATA_ERROR;
1456 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1458 0 0 return state->mode == STORED && state->bits == 0;
0 0 return state->mode == STORED && state->bits == 0;
1471 0 0 if (inflateStateCheck(source) || dest == Z_NULL)
0 0 if (inflateStateCheck(source) || dest == Z_NULL)
1478 0 0 if (copy == Z_NULL) return Z_MEM_ERROR;
1480 0 0 if (state->window != Z_NULL) {
1483 0 0 if (window == Z_NULL) {
1493 0 0 if (state->lencode >= state->codes &&
0 0 if (state->lencode >= state->codes &&
1499 0 0 if (window != Z_NULL) {
1514 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1532 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1534 0 0 if (check)
1546 0 0 if (inflateStateCheck(strm))
1549 0 0 return (long)(((unsigned long)((long)state->back)) << 16) +
0 0 return (long)(((unsigned long)((long)state->back)) << 16) +
1558 0 0 if (inflateStateCheck(strm)) return (unsigned long)-1;