Branch Coverage

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


line true false branch
109 6330 0 if (strm == Z_NULL ||
6330 0 if (strm == Z_NULL ||
110 0 6330 strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
113 6330 0 if (state == Z_NULL || state->strm != strm ||
6330 0 if (state == Z_NULL || state->strm != strm ||
6330 0 if (state == Z_NULL || state->strm != strm ||
114 0 6330 state->mode < HEAD || state->mode > SYNC)
124 0 1178 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
128 1178 0 if (state->wrap) /* to support ill-conceived Java test suite */
149 0 1178 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
165 0 1178 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
169 0 1178 if (windowBits < 0) {
182 1178 0 if (windowBits && (windowBits < 8 || windowBits > 15))
1178 0 if (windowBits && (windowBits < 8 || windowBits > 15))
0 1178 if (windowBits && (windowBits < 8 || windowBits > 15))
184 0 1178 if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
0 0 if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
204 1178 0 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
1178 0 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
0 1178 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
207 0 1178 if (strm == Z_NULL) return Z_STREAM_ERROR;
209 1178 0 if (strm->zalloc == (alloc_func)0) {
217 1178 0 if (strm->zfree == (free_func)0)
225 0 1178 if (state == Z_NULL) return Z_MEM_ERROR;
232 0 1178 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 556 440 if (state->window == Z_NULL) {
411 0 556 if (state->window == Z_NULL) return 1;
415 556 440 if (state->wsize == 0) {
422 0 996 if (copy >= state->wsize) {
429 996 0 if (dist > copy) dist = copy;
432 0 996 if (copy) {
439 0 996 if (state->wnext == state->wsize) state->wnext = 0;
440 996 0 if (state->whave < state->wsize) state->whave += dist;
645 1618 0 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
1618 0 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
0 1618 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
646 0 0 (strm->next_in == Z_NULL && strm->avail_in != 0))
650 0 1618 if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
658 0 1178 if (state->wrap == 0) {
662 0 2356 NEEDBITS(16);
2356 1178 NEEDBITS(16);
678 0 1178 if (
685 0 1178 if (BITS(4) != Z_DEFLATED) {
692 0 1178 if (state->wbits == 0)
694 1178 0 if (len > 15 || len > state->wbits) {
0 1178 if (len > 15 || len > state->wbits) {
702 0 1178 state->mode = hold & 0x200 ? DICTID : TYPE;
838 0 0 NEEDBITS(32);
0 0 NEEDBITS(32);
843 0 0 if (state->havedict == 0) {
850 2240 0 if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
2240 0 if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
852 1062 1178 if (state->last) {
857 0 1178 NEEDBITS(3);
1178 1178 NEEDBITS(3);
871 0 760 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 836 NEEDBITS(14);
836 418 NEEDBITS(14);
929 418 0 if (state->nlen > 286 || state->ndist > 30) {
0 418 if (state->nlen > 286 || state->ndist > 30) {
939 6630 418 while (state->have < state->ncode) {
940 0 2467 NEEDBITS(3);
2467 6630 NEEDBITS(3);
944 1312 418 while (state->have < 19)
951 0 418 if (ret) {
960 30872 418 while (state->have < state->nlen + state->ndist) {
963 30872 11087 if ((unsigned)(here.bits) <= bits) break;
964 0 11087 PULLBYTE();
966 26659 4213 if (here.val < 16) {
971 233 3980 if (here.val == 16) {
972 0 24 NEEDBITS(here.bits + 2);
24 233 NEEDBITS(here.bits + 2);
974 0 233 if (state->have == 0) {
983 2353 1627 else if (here.val == 17) {
984 0 1154 NEEDBITS(here.bits + 3);
1154 2353 NEEDBITS(here.bits + 3);
991 0 1315 NEEDBITS(here.bits + 7);
1315 1627 NEEDBITS(here.bits + 7);
997 0 4213 if (state->have + copy > state->nlen + state->ndist) {
1002 94595 4213 while (copy--)
1008 0 418 if (state->mode == BAD) break;
1011 0 418 if (state->lens[256] == 0) {
1025 0 418 if (ret) {
1034 0 418 if (ret) {
1041 0 418 if (flush == Z_TREES) goto inf_leave;
1045 84530 1228 if (have >= 6 && left >= 258) {
95 84435 if (have >= 6 && left >= 258) {
1049 7 88 if (state->mode == TYPE)
1056 85663 64661 if ((unsigned)(here.bits) <= bits) break;
1057 0 64661 PULLBYTE();
1059 4200 81463 if (here.op && (here.op & 0xf0) == 0) {
0 4200 if (here.op && (here.op & 0xf0) == 0) {
1064 0 0 if ((unsigned)(last.bits + here.bits) <= bits) break;
1065 0 0 PULLBYTE();
1073 81463 4200 if ((int)(here.op) == 0) {
1080 1055 3145 if (here.op & 32) {
1086 0 3145 if (here.op & 64) {
1094 488 2657 if (state->extra) {
1095 0 117 NEEDBITS(state->extra);
117 488 NEEDBITS(state->extra);
1106 3145 1004 if ((unsigned)(here.bits) <= bits) break;
1107 0 1004 PULLBYTE();
1109 0 3145 if ((here.op & 0xf0) == 0) {
1114 0 0 if ((unsigned)(last.bits + here.bits) <= bits) break;
1115 0 0 PULLBYTE();
1122 0 3145 if (here.op & 64) {
1131 2393 752 if (state->extra) {
1132 0 1289 NEEDBITS(state->extra);
1289 2393 NEEDBITS(state->extra);
1147 141 3324 if (left == 0) goto inf_leave;
1149 796 2528 if (state->offset > copy) { /* copy from window */
1151 0 796 if (copy > state->whave) {
1152 0 0 if (state->sane) {
1171 0 796 if (copy > state->wnext) {
1177 573 223 if (copy > state->length) copy = state->length;
1183 102 3222 if (copy > left) copy = left;
1188 27976 3324 } while (--copy);
1189 3112 212 if (state->length == 0) state->mode = LEN;
1192 415 81380 if (left == 0) goto inf_leave;
1198 1062 0 if (state->wrap) {
1199 0 4248 NEEDBITS(32);
4248 1062 NEEDBITS(32);
1203 1062 0 if ((state->wrap & 4) && out)
1062 0 if ((state->wrap & 4) && out)
1207 1062 0 if ((state->wrap & 4) && (
0 1062 if ((state->wrap & 4) && (
1255 1178 440 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
556 622 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
556 0 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
0 556 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
1256 0 0 (state->mode < CHECK || flush != Z_FINISH)))
1257 0 996 if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
1266 1618 0 if ((state->wrap & 4) && out)
556 1062 if ((state->wrap & 4) && out)
1269 1618 0 strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
1270 0 1618 (state->mode == TYPE ? 128 : 0) +
1271 1618 0 (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
0 1618 (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
1272 0 1618 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
0 0 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
1618 0 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
556 1062 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
1281 0 1178 if (inflateStateCheck(strm))
1284 556 622 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;