git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Infinite loop + memory leak in annotate_refs_with_symref_info
@ 2023-04-11 19:53 Jonas Haag
  2023-04-11 20:25 ` Taylor Blau
  2023-04-11 21:06 ` Jeff King
  0 siblings, 2 replies; 30+ messages in thread
From: Jonas Haag @ 2023-04-11 19:53 UTC (permalink / raw)
  To: git

Hello!

There is an infinite loop with an accompanying memory leak in annotate_refs_with_symref_info that was introduced in Git 2.28 (I think in commit 2c6a403: “connect: add function to parse multiple v1 capability values”).

To reproduce the issue, start Klaus [1] using the --smarthttp option and attempt to clone a repository. git-remote-http will enter an infinite loop.

I think this is triggered by a bug in Dulwich, the Python Git implementation that Klaus uses. I’m assuming that Dulwich sends some invalid responses that make the Git client go into an infinite loop.

I believe the bug in Git is in connect.c, function parse_feature_value, in the updating of `*offset`: It doesn’t seem to take into account that `feature_list` has already been offset by `*offset`. I believe the update needs to use `*offset +=` instead of `*offset =`. When I make this change, the infinite loop seems to go away, and cloning via Klaus/Dulwich will fail with “invalid index-pack output”. Cloning from github.com works, although I’m not sure if that’s a relevant smoke test in this case.

Jonas

[1] https://github.com/jonashaag/klaus

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-04-17 16:06 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-11 19:53 Infinite loop + memory leak in annotate_refs_with_symref_info Jonas Haag
2023-04-11 20:25 ` Taylor Blau
2023-04-11 23:59   ` Taylor Blau
2023-04-12  0:53   ` brian m. carlson
2023-04-11 21:06 ` Jeff King
2023-04-11 21:16   ` Jeff King
2023-04-11 21:22     ` Taylor Blau
2023-04-11 21:58       ` Jeff King
2023-04-11 22:52         ` Junio C Hamano
2023-04-12  6:23           ` [PATCH 0/7] v0 multiple-symref infinite loop fix and test cleanup Jeff King
2023-04-12  6:29             ` [PATCH 1/7] v0 protocol: fix infinite loop when parsing multi-valued capabilities Jeff King
2023-04-12  6:46               ` Jeff King
2023-04-12  7:25                 ` [PATCH v2 " Jeff King
2023-04-12  7:26                   ` Jeff King
2023-04-12  6:29             ` [PATCH 2/7] t5512: stop referring to "v1" protocol Jeff King
2023-04-12  6:31             ` [PATCH 3/7] t5512: stop using jgit for capabilities^{} test Jeff King
2023-04-12  9:04               ` Jeff King
2023-04-14 21:24                 ` [PATCH v3 0/7] v0 multiple-symref infinite loop fix and test cleanup Jeff King
2023-04-14 21:24                   ` [PATCH v3 1/7] v0 protocol: fix infinite loop when parsing multi-valued capabilities Jeff King
2023-04-14 21:24                   ` [PATCH v3 2/7] t5512: stop referring to "v1" protocol Jeff King
2023-04-14 21:25                   ` [PATCH v3 3/7] v0 protocol: fix sha1/sha256 confusion for capabilities^{} Jeff King
2023-04-14 21:25                   ` [PATCH v3 4/7] t5512: add v2 support for "ls-remote --symref" test Jeff King
2023-04-14 21:25                   ` [PATCH v3 5/7] t5512: allow any protocol version for filtered symref test Jeff King
2023-04-14 21:25                   ` [PATCH v3 6/7] t5512: test "ls-remote --heads --symref" filtering with v0 and v2 Jeff King
2023-04-14 21:25                   ` [PATCH v3 7/7] v0 protocol: use size_t for capability length/offset Jeff King
2023-04-17 16:06                   ` [PATCH v3 0/7] v0 multiple-symref infinite loop fix and test cleanup Junio C Hamano
2023-04-12  6:34             ` [PATCH 4/7] t5512: add v2 support for "ls-remote --symref" test Jeff King
2023-04-12  6:35             ` [PATCH 5/7] t5512: allow any protocol version for filtered symref test Jeff King
2023-04-12  6:37             ` [PATCH 6/7] t5512: test "ls-remote --heads --symref" filtering with v0 and v2 Jeff King
2023-04-12  6:40             ` [PATCH 7/7] v0 protocol: use size_t for capability length/offset Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).