Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-04-22 23:42:44 +0300
committerJunio C Hamano <gitster@pobox.com>2020-04-22 23:42:44 +0300
commit8777ec119e94782e7e5e49367cd40e0ee412bcb3 (patch)
treeec9a50102c031d45fdd19366afbb183b31ace958 /t
parent7a8e6305d8d76df7551de8be2d5732c2ac3248b9 (diff)
parent796d61cdc09c8f3068403965531f27fd11c739e9 (diff)
Merge branch 'dr/midx-avoid-int-underflow'
When fed a midx that records no objects, some codepaths tried to loop from 0 through (num_objects-1), which, due to integer arithmetic wrapping around, made it nonsense operation with out of bounds array accesses. The code has been corrected to reject such an midx file. * dr/midx-avoid-int-underflow: midx.c: fix an integer underflow
Diffstat (limited to 't')
-rwxr-xr-xt/t5319-multi-pack-index.sh13
-rw-r--r--t/t5319/no-objects.midxbin0 -> 1116 bytes
2 files changed, 9 insertions, 4 deletions
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 43a7a66c9d..22240fd30b 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -42,10 +42,15 @@ test_expect_success 'setup' '
EOF
'
-test_expect_success 'write midx with no packs' '
- test_when_finished rm -f pack/multi-pack-index &&
- git multi-pack-index --object-dir=. write &&
- midx_read_expect 0 0 4 .
+test_expect_success "don't write midx with no packs" '
+ test_must_fail git multi-pack-index --object-dir=. write &&
+ test_path_is_missing pack/multi-pack-index
+'
+
+test_expect_success "Warn if a midx contains no oid" '
+ cp "$TEST_DIRECTORY"/t5319/no-objects.midx $objdir/pack/multi-pack-index &&
+ test_must_fail git multi-pack-index verify &&
+ rm $objdir/pack/multi-pack-index
'
generate_objects () {
diff --git a/t/t5319/no-objects.midx b/t/t5319/no-objects.midx
new file mode 100644
index 0000000000..e466b8e086
--- /dev/null
+++ b/t/t5319/no-objects.midx
Binary files differ