3 test_description
='Test responses to violations of the network protocol. In most
4 of these cases it will generally be acceptable for one side to break off
5 communications if the other side says something unexpected. We are mostly
6 making sure that we do not segfault or otherwise behave badly.'
8 TEST_PASSES_SANITIZE_LEAK
=true
11 test_expect_success
'extra delim packet in v2 ls-refs args' '
13 packetize command=ls-refs &&
14 packetize "object-format=$(test_oid algo)" &&
16 # protocol expects 0000 flush here
19 test_must_fail env GIT_PROTOCOL=version=2 \
20 git upload-pack . <input 2>err &&
21 test_i18ngrep "expected flush after ls-refs arguments" err
24 test_expect_success
'extra delim packet in v2 fetch args' '
26 packetize command=fetch &&
27 packetize "object-format=$(test_oid algo)" &&
29 # protocol expects 0000 flush here
32 test_must_fail env GIT_PROTOCOL=version=2 \
33 git upload-pack . <input 2>err &&
34 test_i18ngrep "expected flush after fetch arguments" err
37 test_expect_success
'bogus symref in v0 capabilities' '
39 oid=$(git rev-parse HEAD) &&
42 printf "%s HEAD\0symref object-format=%s symref=HEAD:%s\n" \
43 "$oid" "$GIT_DEFAULT_HASH" "$dst" |
44 test-tool pkt-line pack-raw-stdin &&
47 git ls-remote --symref --upload-pack="cat input; read junk;:" . >actual &&
48 printf "ref: %s\tHEAD\n%s\tHEAD\n" "$dst" "$oid" >expect &&
49 test_cmp expect actual