git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] object-file: fix closing object stream twice

From
Jeff King <peff@peff.net>
Date
Jul 11, 2026, 07:33 UTC
Message-ID
<20260711073320.GA1457061@coredump.intra.peff.net>
In-Reply-To
<20260710-pks-odb-stream-double-close-v1-1-d5fa233a37c7@pks.im>
On Fri, Jul 10, 2026 at 04:54:16PM +0200, Patrick Steinhardt wrote:
Show 5 quoted lines
> And while the mentioned commit did drop one call that closed the stream,
> there's a second such call that was missed when reading from the stream
> fails. The consequence of this can be a double free of the stream.
> 
> Fix the bug by dropping that leftover call to `odb_read_stream_close()`.
Thanks, both the patch and the new test look good to me.
Show 9 quoted lines
> Note that it was originally discussed whether this should be treated as
> a security vulnerability. But there are only two callers: once via
> `parse_object_with_flags()`, and once via `verify_packfile()`. Neither
> of these callers plays any role on the transport layer, so this issue is
> only relevant for objects that are already available via the local
> object database. Furthermore, a packfile that is corrupted in this way
> would be detected when receiving the packfile, so it's not easy for an
> adversary to plant such a packfile, either. Consequently, we decided
> that this is not covered as part of our threat model.

I think this case probably would violate our "it is OK to clone from the local untrusted .git repo" goal (since you could perhaps get to this code path via upload-pack/pack-objects, though I didn't try it myself).

But the text in git(1)'s SECURITY section is pretty clear that it is more goal than promise, and that this scenario carries extra risk exactly because of the increased attack surface. And that you can mitigate by serving from an untrusted user.

-Peff
Previous: Patrick Steinhardt
Message 2 of 2 in “object-file: fix closing object stream twice”
  1. object-file: fix closing object stream twicePatrick Steinhardt, Jul 10, 2026
  2. Jeff KingJul 11, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.