line |
true |
false |
branch |
84
|
0 |
1569 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, be->objects_dirlen, GIT_OID_HEXSZ); |
|
0 |
1569 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, be->objects_dirlen, GIT_OID_HEXSZ); |
85
|
0 |
1569 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 3); |
|
0 |
1569 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 3); |
86
|
0 |
1569 |
if (git_buf_grow(name, alloclen) < 0) |
113
|
0 |
0 |
if (len == 0) |
121
|
0 |
0 |
while (c & 0x80) { |
122
|
0 |
0 |
if (len <= used) |
125
|
0 |
0 |
if (sizeof(size_t) * 8 <= shift) |
135
|
0 |
0 |
if (out_len) |
158
|
6429 |
0 |
for (i = 0, typename_len = 0; i < data_len; i++, typename_len++) { |
159
|
1128 |
5301 |
if (data[i] == ' ') |
163
|
0 |
1128 |
if (typename_len == data_len) |
169
|
3761 |
0 |
for (i = size_idx, size_len = 0; i < data_len; i++, size_len++) { |
170
|
1128 |
2633 |
if (data[i] == '\0') |
174
|
0 |
1128 |
if (i == data_len) |
177
|
1128 |
0 |
if (git__strntol64(&size, &data[size_idx], size_len, NULL, 10) < 0 || |
|
1128 |
0 |
if (git__strntol64(&size, &data[size_idx], size_len, NULL, 10) < 0 || |
188
|
0 |
1128 |
if (GIT_ADD_SIZET_OVERFLOW(out_len, i, 1)) |
|
0 |
1128 |
if (GIT_ADD_SIZET_OVERFLOW(out_len, i, 1)) |
202
|
0 |
1128 |
if (data_len < 2) |
206
|
1128 |
0 |
return (data[0] & 0x8F) == 0x08 && !(w % 31); |
|
1128 |
0 |
return (data[0] & 0x8F) == 0x08 && !(w % 31); |
240
|
0 |
0 |
if ((error = parse_header_packlike(&hdr, &head_len, obj_data, obj_len)) < 0) |
243
|
0 |
0 |
if (!git_object_typeisloose(hdr.type) || head_len > obj_len) { |
|
0 |
0 |
if (!git_object_typeisloose(hdr.type) || head_len > obj_len) { |
255
|
0 |
0 |
if (GIT_ADD_SIZET_OVERFLOW(&alloc_size, hdr.size, 1) || |
|
0 |
0 |
if (GIT_ADD_SIZET_OVERFLOW(&alloc_size, hdr.size, 1) || |
261
|
0 |
0 |
if ((error = git_zstream_inflatebuf(&body, obj_data, obj_len)) < 0) |
281
|
745 |
0 |
if ((error = git_zstream_init(&zstream, GIT_ZSTREAM_INFLATE)) < 0 || |
|
745 |
0 |
if ((error = git_zstream_init(&zstream, GIT_ZSTREAM_INFLATE)) < 0 || |
292
|
745 |
0 |
if ((error = git_zstream_get_output(head, &decompressed, &zstream)) < 0 || |
|
745 |
0 |
if ((error = git_zstream_get_output(head, &decompressed, &zstream)) < 0 || |
296
|
0 |
745 |
if (!git_object_typeisloose(hdr.type)) { |
306
|
0 |
745 |
if (GIT_ADD_SIZET_OVERFLOW(&alloc_size, hdr.size, 1) || |
|
0 |
745 |
if (GIT_ADD_SIZET_OVERFLOW(&alloc_size, hdr.size, 1) || |
312
|
0 |
745 |
assert(decompressed >= head_len); |
315
|
730 |
15 |
if (body_len) |
319
|
0 |
745 |
if ((error = git_zstream_get_output(body + body_len, &decompressed, &zstream)) < 0) |
322
|
0 |
745 |
if (!git_zstream_done(&zstream)) { |
335
|
0 |
745 |
if (error < 0) |
347
|
745 |
0 |
assert(out && loc); |
|
0 |
745 |
assert(out && loc); |
349
|
0 |
745 |
if (git_buf_oom(loc)) |
356
|
0 |
745 |
if ((error = git_futils_readbuffer(&obj, loc->ptr)) < 0) |
359
|
0 |
745 |
if (!is_zlib_compressed_data((unsigned char *)obj.ptr, obj.size)) |
376
|
0 |
0 |
if ((error = parse_header_packlike(&hdr, &header_len, data, len)) < 0) |
394
|
383 |
0 |
if ((error = git_zstream_init(&zs, GIT_ZSTREAM_INFLATE)) < 0 || |
|
383 |
0 |
if ((error = git_zstream_init(&zs, GIT_ZSTREAM_INFLATE)) < 0 || |
395
|
383 |
0 |
(error = git_zstream_set_input(&zs, data, len)) < 0 || |
396
|
383 |
0 |
(error = git_zstream_get_output_chunk(inflated, &inflated_len, &zs)) < 0 || |
414
|
383 |
0 |
assert(out && loc); |
|
0 |
383 |
assert(out && loc); |
416
|
0 |
383 |
if (git_buf_oom(loc)) |
421
|
0 |
383 |
if ((error = fd = git_futils_open_ro(loc->ptr)) < 0) |
424
|
0 |
383 |
if ((obj_len = p_read(fd, obj, sizeof(obj))) < 0) { |
429
|
0 |
383 |
if (!is_zlib_compressed_data(obj, (size_t)obj_len)) |
434
|
383 |
0 |
if (!error && !git_object_typeisloose(out->type)) { |
|
0 |
383 |
if (!error && !git_object_typeisloose(out->type)) { |
441
|
383 |
0 |
if (fd >= 0) |
453
|
1126 |
0 |
if (!error && !git_path_exists(object_location->ptr)) |
|
2 |
1124 |
if (!error && !git_path_exists(object_location->ptr)) |
463
|
0 |
10 |
if (git_buf_len(pathbuf) - sstate->dir_len != GIT_OID_HEXSZ - 2) { |
468
|
10 |
0 |
if (git_path_isdir(pathbuf->ptr) == false) { |
471
|
8 |
2 |
if (!memcmp(sstate->short_oid + 2, |
475
|
8 |
0 |
if (!sstate->found) { |
484
|
0 |
10 |
if (sstate->found > 1) |
504
|
0 |
16 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ); |
|
0 |
16 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ); |
505
|
0 |
16 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 3); |
|
0 |
16 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 3); |
506
|
0 |
16 |
if (git_buf_grow(object_location, alloc_len) < 0) |
519
|
0 |
16 |
if (git_buf_put(object_location, (char *)state.short_oid, 3) < 0) |
524
|
6 |
10 |
if (git_path_isdir(object_location->ptr) == false) |
535
|
0 |
10 |
if (error < 0 && error != GIT_EAMBIGUOUS) |
|
0 |
0 |
if (error < 0 && error != GIT_EAMBIGUOUS) |
538
|
2 |
8 |
if (!state.found) |
542
|
0 |
8 |
if (state.found > 1) |
547
|
0 |
8 |
if (error) |
551
|
0 |
8 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ); |
|
0 |
8 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ); |
552
|
0 |
8 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2); |
|
0 |
8 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2); |
555
|
0 |
8 |
if (git_buf_grow(object_location, alloc_len) < 0) |
588
|
383 |
0 |
assert(backend && oid); |
|
0 |
383 |
assert(backend && oid); |
593
|
0 |
383 |
if (locate_object(&object_path, (loose_backend *)backend, oid) < 0) { |
596
|
383 |
0 |
} else if ((error = read_header_loose(&raw, &object_path)) == 0) { |
612
|
739 |
0 |
assert(backend && oid); |
|
0 |
739 |
assert(backend && oid); |
614
|
2 |
737 |
if (locate_object(&object_path, (loose_backend *)backend, oid) < 0) { |
617
|
737 |
0 |
} else if ((error = read_loose(&raw, &object_path)) == 0) { |
639
|
138 |
0 |
assert(len >= GIT_OID_MINPREFIXLEN && len <= GIT_OID_HEXSZ); |
|
0 |
138 |
assert(len >= GIT_OID_MINPREFIXLEN && len <= GIT_OID_HEXSZ); |
641
|
122 |
16 |
if (len == GIT_OID_HEXSZ) { |
644
|
122 |
0 |
if (!error) |
650
|
16 |
0 |
assert(backend && short_oid); |
|
0 |
16 |
assert(backend && short_oid); |
652
|
8 |
8 |
if ((error = locate_object_short_oid(&object_path, out_oid, |
653
|
8 |
0 |
(loose_backend *)backend, short_oid, len)) == 0 && |
672
|
4 |
0 |
assert(backend && oid); |
|
0 |
4 |
assert(backend && oid); |
687
|
0 |
0 |
assert(backend && out && short_id && len >= GIT_OID_MINPREFIXLEN); |
|
0 |
0 |
assert(backend && out && short_id && len >= GIT_OID_MINPREFIXLEN); |
|
0 |
0 |
assert(backend && out && short_id && len >= GIT_OID_MINPREFIXLEN); |
|
0 |
0 |
assert(backend && out && short_id && len >= GIT_OID_MINPREFIXLEN); |
706
|
0 |
121 |
if (strlen(ptr) != GIT_OID_HEXSZ+1) |
709
|
0 |
121 |
if (ptr[2] != '/') { |
714
|
0 |
121 |
if (v < 0) |
720
|
2299 |
121 |
for (i = 0; i < 38; i += 2) { |
722
|
0 |
2299 |
if (v < 0) |
736
|
0 |
121 |
if (filename_to_oid(&oid, path->ptr + state->dir_len) < 0) |
748
|
0 |
101 |
if (!git_path_isdir(git_buf_cstr(path))) |
762
|
1 |
0 |
assert(backend && cb); |
|
0 |
1 |
assert(backend && cb); |
768
|
0 |
1 |
if (git_buf_oom(&buf)) |
821
|
177 |
0 |
if (backend->fsync_object_files || git_repository__fsync_gitdir) |
|
0 |
177 |
if (backend->fsync_object_files || git_repository__fsync_gitdir) |
836
|
0 |
63 |
assert(_backend); |
841
|
0 |
63 |
if ((error = git_odb__format_object_header(&hdrlen, |
846
|
0 |
63 |
GIT_ERROR_CHECK_ALLOC(stream); |
857
|
0 |
63 |
backend->object_file_mode) < 0 || |
867
|
0 |
63 |
return !stream ? -1 : 0; |
885
|
0 |
0 |
if (start_remain && buffer_len) { |
|
0 |
0 |
if (start_remain && buffer_len) { |
896
|
0 |
0 |
if (buffer_len) { |
899
|
0 |
0 |
if ((error = git_zstream_get_output(buffer, &chunk, &stream->zstream)) < 0) |
932
|
0 |
0 |
if ((error = parse_header_packlike(hdr, &head_len, data, data_len)) < 0) |
935
|
0 |
0 |
if (!git_object_typeisloose(hdr->type)) { |
952
|
0 |
0 |
if ((error = git_zstream_set_input(&stream->zstream, |
963
|
0 |
0 |
if ((error = git_zstream_get_output(head, &init, &stream->zstream)) < 0 || |
|
0 |
0 |
if ((error = git_zstream_get_output(head, &init, &stream->zstream)) < 0 || |
967
|
0 |
0 |
if (!git_object_typeisloose(hdr->type)) { |
972
|
0 |
0 |
if (init > head_len) { |
994
|
0 |
0 |
assert(stream_out && len_out && type_out && _backend && oid); |
|
0 |
0 |
assert(stream_out && len_out && type_out && _backend && oid); |
|
0 |
0 |
assert(stream_out && len_out && type_out && _backend && oid); |
|
0 |
0 |
assert(stream_out && len_out && type_out && _backend && oid); |
|
0 |
0 |
assert(stream_out && len_out && type_out && _backend && oid); |
1001
|
0 |
0 |
if (locate_object(&object_path, backend, oid) < 0) { |
1008
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(stream); |
1011
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(hash_ctx); |
1013
|
0 |
0 |
if ((error = git_hash_ctx_init(hash_ctx)) < 0 || |
|
0 |
0 |
if ((error = git_hash_ctx_init(hash_ctx)) < 0 || |
1014
|
0 |
0 |
(error = git_futils_mmap_ro_file(&stream->map, object_path.ptr)) < 0 || |
1019
|
0 |
0 |
if (!is_zlib_compressed_data(stream->map.data, stream->map.len)) |
1024
|
0 |
0 |
if (error < 0) |
1037
|
0 |
0 |
if (error < 0) { |
1038
|
0 |
0 |
if (stream) { |
1043
|
0 |
0 |
if (hash_ctx) { |
1065
|
0 |
114 |
if ((error = git_odb__format_object_header(&header_len, |
1081
|
0 |
114 |
object_mkdir(&final_path, backend) < 0 || |
1086
|
0 |
114 |
if (error < 0) |
1100
|
0 |
286 |
if (object_file_name(&path, backend, oid) < 0) |
1112
|
0 |
36 |
assert(_backend); |
1129
|
36 |
0 |
assert(backend_out && objects_dir); |
|
0 |
36 |
assert(backend_out && objects_dir); |
1133
|
0 |
36 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(loose_backend), objects_dirlen); |
|
0 |
36 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(loose_backend), objects_dirlen); |
1134
|
0 |
36 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 2); |
|
0 |
36 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 2); |
1136
|
0 |
36 |
GIT_ERROR_CHECK_ALLOC(backend); |
1141
|
3 |
33 |
if (backend->objects_dir[backend->objects_dirlen - 1] != '/') |
1144
|
35 |
1 |
if (compression_level < 0) |
1147
|
36 |
0 |
if (dir_mode == 0) |
1150
|
36 |
0 |
if (file_mode == 0) |