Branch Coverage

deps/libgit2/deps/zlib/inflate.c
Criterion Covered Total %
branch 175 398 43.9


line true false branch
109 6336 0 if (strm == Z_NULL ||
6336 0 if (strm == Z_NULL ||
110 0 6336 strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
113 6336 0 if (state == Z_NULL || state->strm != strm ||
6336 0 if (state == Z_NULL || state->strm != strm ||
6336 0 if (state == Z_NULL || state->strm != strm ||
114 0 6336 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 */
150 0 1178 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
166 0 1178 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
170 0 1178 if (windowBits < 0) {
183 1178 0 if (windowBits && (windowBits < 8 || windowBits > 15))
1178 0 if (windowBits && (windowBits < 8 || windowBits > 15))
0 1178 if (windowBits && (windowBits < 8 || windowBits > 15))
185 0 1178 if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
0 0 if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
205 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] ||
208 0 1178 if (strm == Z_NULL) return Z_STREAM_ERROR;
210 1178 0 if (strm->zalloc == (alloc_func)0) {
218 1178 0 if (strm->zfree == (free_func)0)
226 0 1178 if (state == Z_NULL) return Z_MEM_ERROR;
233 0 1178 if (ret != Z_OK) {
255 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
257 0 0 if (bits < 0) {
262 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;
408 550 446 if (state->window == Z_NULL) {
412 0 550 if (state->window == Z_NULL) return 1;
416 550 446 if (state->wsize == 0) {
423 0 996 if (copy >= state->wsize) {
430 996 0 if (dist > copy) dist = copy;
433 0 996 if (copy) {
440 0 996 if (state->wnext == state->wsize) state->wnext = 0;
441 996 0 if (state->whave < state->wsize) state->whave += dist;
646 1624 0 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
1624 0 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
0 1624 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
647 0 0 (strm->next_in == Z_NULL && strm->avail_in != 0))
651 0 1624 if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
659 0 1178 if (state->wrap == 0) {
663 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) {
703 0 1178 state->mode = hold & 0x200 ? DICTID : TYPE;
846 0 0 NEEDBITS(32);
0 0 NEEDBITS(32);
852 0 0 if (state->havedict == 0) {
860 2252 0 if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
2252 0 if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
863 1074 1178 if (state->last) {
868 0 1178 NEEDBITS(3);
1178 1178 NEEDBITS(3);
882 0 765 if (flush == Z_TREES) {
900 0 0 NEEDBITS(32);
0 0 NEEDBITS(32);
901 0 0 if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
911 0 0 if (flush == Z_TREES) goto inf_leave;
918 0 0 if (copy) {
919 0 0 if (copy > have) copy = have;
920 0 0 if (copy > left) copy = left;
921 0 0 if (copy == 0) goto inf_leave;
934 0 826 NEEDBITS(14);
826 413 NEEDBITS(14);
942 413 0 if (state->nlen > 286 || state->ndist > 30) {
0 413 if (state->nlen > 286 || state->ndist > 30) {
953 6566 413 while (state->have < state->ncode) {
954 0 2444 NEEDBITS(3);
2444 6566 NEEDBITS(3);
958 1281 413 while (state->have < 19)
965 0 413 if (ret) {
975 30276 413 while (state->have < state->nlen + state->ndist) {
978 30276 10863 if ((unsigned)(here.bits) <= bits) break;
979 0 10863 PULLBYTE();
981 26062 4214 if (here.val < 16) {
986 277 3937 if (here.val == 16) {
987 0 20 NEEDBITS(here.bits + 2);
20 277 NEEDBITS(here.bits + 2);
989 0 277 if (state->have == 0) {
998 2330 1607 else if (here.val == 17) {
999 0 1203 NEEDBITS(here.bits + 3);
1203 2330 NEEDBITS(here.bits + 3);
1006 0 1298 NEEDBITS(here.bits + 7);
1298 1607 NEEDBITS(here.bits + 7);
1012 0 4214 if (state->have + copy > state->nlen + state->ndist) {
1017 93711 4214 while (copy--)
1023 0 413 if (state->mode == BAD) break;
1026 0 413 if (state->lens[256] == 0) {
1040 0 413 if (ret) {
1049 0 413 if (ret) {
1056 0 413 if (flush == Z_TREES) goto inf_leave;
1062 84488 1266 if (have >= 6 && left >= 258) {
93 84395 if (have >= 6 && left >= 258) {
1066 7 86 if (state->mode == TYPE)
1073 85661 64840 if ((unsigned)(here.bits) <= bits) break;
1074 0 64840 PULLBYTE();
1076 4122 81539 if (here.op && (here.op & 0xf0) == 0) {
0 4122 if (here.op && (here.op & 0xf0) == 0) {
1081 0 0 if ((unsigned)(last.bits + here.bits) <= bits) break;
1082 0 0 PULLBYTE();
1090 81539 4122 if ((int)(here.op) == 0) {
1097 1067 3055 if (here.op & 32) {
1103 0 3055 if (here.op & 64) {
1112 488 2567 if (state->extra) {
1113 0 95 NEEDBITS(state->extra);
95 488 NEEDBITS(state->extra);
1125 3055 1023 if ((unsigned)(here.bits) <= bits) break;
1126 0 1023 PULLBYTE();
1128 0 3055 if ((here.op & 0xf0) == 0) {
1133 0 0 if ((unsigned)(last.bits + here.bits) <= bits) break;
1134 0 0 PULLBYTE();
1141 0 3055 if (here.op & 64) {
1151 2289 766 if (state->extra) {
1152 0 1066 NEEDBITS(state->extra);
1066 2289 NEEDBITS(state->extra);
1168 60 3212 if (left == 0) goto inf_leave;
1170 711 2501 if (state->offset > copy) { /* copy from window */
1172 0 711 if (copy > state->whave) {
1173 0 0 if (state->sane) {
1192 0 711 if (copy > state->wnext) {
1198 488 223 if (copy > state->length) copy = state->length;
1204 60 3152 if (copy > left) copy = left;
1209 27829 3212 } while (--copy);
1210 3042 170 if (state->length == 0) state->mode = LEN;
1213 490 81448 if (left == 0) goto inf_leave;
1219 1074 0 if (state->wrap) {
1220 0 4296 NEEDBITS(32);
4296 1074 NEEDBITS(32);
1224 1074 0 if ((state->wrap & 4) && out)
1074 0 if ((state->wrap & 4) && out)
1228 1074 0 if ((state->wrap & 4) && (
0 1074 if ((state->wrap & 4) && (
1279 1178 446 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
550 628 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
550 0 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
0 550 if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
1280 0 0 (state->mode < CHECK || flush != Z_FINISH)))
1281 0 996 if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
1290 1624 0 if ((state->wrap & 4) && out)
550 1074 if ((state->wrap & 4) && out)
1293 1624 0 strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
1294 0 1624 (state->mode == TYPE ? 128 : 0) +
1295 1624 0 (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
0 1624 (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
1296 0 1624 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
0 0 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
1624 0 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
550 1074 if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
1305 0 1178 if (inflateStateCheck(strm))
1308 550 628 if (state->window != Z_NULL) ZFREE(strm, state->window);
1323 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1327 0 0 if (state->whave && dictionary != Z_NULL) {
0 0 if (state->whave && dictionary != Z_NULL) {
1333 0 0 if (dictLength != Z_NULL)
1348 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1350 0 0 if (state->wrap != 0 && state->mode != DICT)
0 0 if (state->wrap != 0 && state->mode != DICT)
1354 0 0 if (state->mode == DICT) {
1357 0 0 if (dictid != state->check)
1364 0 0 if (ret) {
1380 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1382 0 0 if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
1411 0 0 while (next < len && got < 4) {
0 0 while (next < len && got < 4) {
1412 0 0 if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
0 0 if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
1414 0 0 else if (buf[next])
1434 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1436 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;
1439 0 0 if (state->mode != SYNC) {
1444 0 0 while (state->bits >= 8) {
1460 0 0 if (state->have != 4) return Z_DATA_ERROR;
1461 0 0 if (state->flags == -1)
1487 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1489 0 0 return state->mode == STORED && state->bits == 0;
0 0 return state->mode == STORED && state->bits == 0;
1502 0 0 if (inflateStateCheck(source) || dest == Z_NULL)
0 0 if (inflateStateCheck(source) || dest == Z_NULL)
1509 0 0 if (copy == Z_NULL) return Z_MEM_ERROR;
1511 0 0 if (state->window != Z_NULL) {
1514 0 0 if (window == Z_NULL) {
1524 0 0 if (state->lencode >= state->codes &&
0 0 if (state->lencode >= state->codes &&
1530 0 0 if (window != Z_NULL) {
1545 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1563 0 0 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1565 0 0 if (check && state->wrap)
0 0 if (check && state->wrap)
1577 0 0 if (inflateStateCheck(strm))
1580 0 0 return (long)(((unsigned long)((long)state->back)) << 16) +
0 0 return (long)(((unsigned long)((long)state->back)) << 16) +
1589 0 0 if (inflateStateCheck(strm)) return (unsigned long)-1;